Last updated 7 March 2016. Created on 15 July 2008.
Edited by gisle, hugovk, aj045, rport. Log in to edit this page.

Benchmarking in simplistic terms is the process where you compare your current performance with that of a better process to improve the overall standard of performance.

This manual page describe a method to measure the performance of the web server for site administrators and how to implement changes to the server or Drupal configuration in order to produce performance improvements.

Measurement

For the purposes of this manual page, we are focusing on the use of ab, the Apache HTTP server benchmarking tool. ab is often found pre installed with many Gnu/Linux distributions, and is designed to give you an impression of how your current Apache installation performs.

For Windows users, the ab tool can usually be found somewhere in the installation path of your Apache-based web server. For example, in WAMP it can be found in c:/<path to WAMP>/bin/apache/Apache<version here>/bin. Using the Windows command prompt (accessible by going to "Start", "Run" and typing "cmd"), navigate to the directory containing ab and then you can use the tool as outlined in the examples below. Alternatively, you can place the path to Apache's bin folder in your PATH variable, thus making the ab tool accessible without the need to navigate to it's directory every time you launch the command prompt.

For the examples below we used the following CLI command;

ab -n 100 -c 10 http://yourserver.com/

Where;

-n
Number of requests to perform for the benchmarking session. (option = 100)
-c
Number of multiple requests to perform at a time. (option = 10)

Optimizing Drupal

By default, Drupal has two settings to improve performance;

  • Page Cache
    The normal cache mode is suitable for most sites and does not cause any side effects. The aggressive cache mode causes Drupal to skip the loading (init) and unloading (exit) of enabled modules when serving a cached page. This results in an additional performance boost but can cause unwanted side effects.
  • Bandwidth optimizations - Aggregate and compress CSS files
    Some Drupal modules include their own CSS files. When these modules are enabled, each module's CSS file adds an additional HTTP request to the page, which can increase the load time of each page. These HTTP requests can also slightly increase server load. It is recommended to only turn this option on when your site is in production, as it can interfere with theme development.

Where to find Drupal's performance settings

  • D6: /admin/settings/performance
  • D7: /admin/config/development/performance
  • D8: /admin/config/development/performance

The example output shown below is available in the CLI as output from the ab tool:

CSS Aggregation OFF, Page Cache OFF

Concurrency Level:      10
Time taken for tests:   35.160824 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1631700 bytes
HTML transferred:       1582800 bytes
Requests per second:    2.84 [#/sec] (mean)
Time per request:       3516.082 [ms] (mean)
Time per request:       351.608 [ms] (mean, across all concurrent requests)
Transfer rate:          45.31 [Kbytes/sec] received

CSS Aggregation ON, Page Cache OFF

Concurrency Level:      10
Time taken for tests:   34.796567 seconds
Complete requests:      100
Failed requests:        1
   (Connect: 0, Length: 1, Exceptions: 0)
Write errors:           0
Non-2xx responses:      1
Total transferred:      1469540 bytes
HTML transferred:       1420867 bytes
Requests per second:    2.87 [#/sec] (mean)
Time per request:       3479.657 [ms] (mean)
Time per request:       347.966 [ms] (mean, across all concurrent requests)
Transfer rate:          41.24 [Kbytes/sec] received

CSS Aggregation ON, Page Cache ON

Concurrency Level:      10
Time taken for tests:   5.461753 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1525206 bytes
HTML transferred:       1476505 bytes
Requests per second:    18.31 [#/sec] (mean)
Time per request:       546.175 [ms] (mean)
Time per request:       54.618 [ms] (mean, across all concurrent requests)
Transfer rate:          272.62 [Kbytes/sec] received

See also

External links

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.