Three Basic Steps to Optimizing Drupal

There are a few simple steps you can take to optimize Drupal. Drupal is a large, heavy system: every advantage counts.

This initial benchmark is taken without any of the variables which I'm going to test: css aggregation, mod_deflate, and apc.


ab -n100 http://drupal.shadowlife.ca/drupal-5.7/


Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 24 40 20.4 31 123
Waiting: 21 34 17.2 28 119
Total: 24 40 20.4 31 123

Percentage of the requests served within a certain time (ms)
50% 31
66% 37
75% 45
80% 56
90% 73
95% 88
98% 105
99% 123
100% 123 (longest request)

The first, is to turn on CSS aggregation. The results from this simple step -- which everyone can do -- is not that impressive for single requests:


Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.0 0 10
Processing: 24 43 24.6 34 166
Waiting: 21 35 18.7 29 128
Total: 24 43 24.6 34 166

Percentage of the requests served within a certain time (ms)
50% 34
66% 42
75% 52
80% 56
90% 78
95% 86
98% 143
99% 166
100% 166 (longest request)

We've actually increased the amount of time required to service requests. Not very handy. Don't give up yet, though.

What else can we do? If you run your own apache server and you don't have shared hosting, enable the mod_deflate module. Despite its name, this module lets apache transparently compress files for transfer, if the user's browser allows it. Most do, so enabling mod_deflate can offer a significant performance boost for most of your users. Let's see what we get after enabling it, and making sure to specify we can accept Gzipped pags (with the -H 'Accept-Encoding: gzip' parameter.


Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 23 45 20.2 38 118
Waiting: 21 36 15.4 31 89
Total: 23 45 20.2 38 118

Percentage of the requests served within a certain time (ms)
50% 38
66% 50
75% 60
80% 64
90% 76
95% 89
98% 105
99% 118
100% 118 (longest request)

Not so bad: request time is on its way down.

The third thing we can do is install a php opcode cache. This caches the results of the compiled php files. This is responsible for a substantial majority of the request time:


Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 2
Processing: 4 13 15.9 8 119
Waiting: 3 11 14.5 6 116
Total: 4 13 15.9 8 119

Percentage of the requests served within a certain time (ms)
50% 8
66% 11
75% 15
80% 17
90% 35
95% 44
98% 66
99% 119
100% 119 (longest request)

Excellent! We've moved our < 40ms response time mark to 90% of all requests served, instead of 50%. And half of all requests are now served in 1/5th of the time they previously took.

Optimizing Drupal is important because it lets you serve pages faster, and puts far less of a load on the server. The larger your Drupal site is, the more it will benefit from the opcode cache.

For more information on Drupal performance (or, even LAMP performance in general) here are some resources:

Post new comment

All comment submissions must follow the Comment Policy. Your words remain your own and you are responsible for them. If you don't like the captcha, Login to a user account. You can login with OpenID too..
The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <embed> <blockquote> <p> <iframe> <div> <span> <tt>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
c
e
4
A
C
f
P
Enter the code without spaces and pay attention to upper/lower case.

ryanernst.com RSS feed

Powered by Drupal, an open source content management system

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer