Drupal Speed - VPS Sites Can Benefit from Simple Apache Configuration Tweaks

Is your Drupal site slow? Are you looking for some methods to make it faster without throwing money at the problem? The kinds of optimizations you should make depend highly on what matters to you most. Improving page load time without breaking your monthly budget will force one set of decisions, while improving the number of users served per second will likely force additional choices.

Folks are often interested in getting the most out of less expensive hardware, which means optimizing slower servers with lower available memory. Personally, I find that this makes the challenge of speeding a site up even more interesting.

One remarkable tool to help you debug your specific situation is http://webpagetest.org. While tools like Firebug and the Chrome Developer Tools are good for programmers and designers, I really like the ease of use with http://webpagetest.org, especially when I'm asking others to have a look into their sites.

To get a sense for how this works, compare this "slow" chart with this "less slow" chart. (The live versions of these charts have very useful links on them.) You can see that it's the same webpage being tested in both tests, but paying attention to the times across the top in seconds, you can see that diving into the details of those charts managed to cut the page load time in half, and that was done with some very simple tweaks to the system configuration. One of the powerful components of http://webpagetest.org is that the site itself makes predictions about what's achievable and guides you toward settings and tweaks that might make a difference.

When you start working with a VPS, you're often working with Apache and MySQL configurations that are part of out-of-the-box distributions. This can mean that you're not getting the most out of your hardware. It helps if you have a set of scripts that enable quick configuration of a given distribution's settings. That sort of thing is becoming more and more popular, with recipes being posted for using cloud services like Amazon's EC2.

For example, you may be suffering from the fact that Apache's KeepAlive is often not enabled by default, or your MySQL query cache might be turned off.

Optimizing for your site means understanding your particular site in detail, and using a speed profiler like http://webpagetest.org can lead to very creative solutions depending on your specific content. For instance, you can even make a page seem faster by ADDING an image.

Where screen real-estate is a challenge (if you really need to present more information than you have space for), you can use time to your advantage by showing a slideshow as a significant part of the page. Each slide can tempt the user to a different part of your site. These are all over the web for a reason, and they're very effective. But think for a moment about how the browser builds a page, and you'll see a trick for making things seem lightning fast to the user. Arrange to have the first slide shown be one that has a very small file size. It will pop up in the render phase very quickly, while the remaining images for the slideshow load after the first one is visible.

Those who looked closely at the charts above will notice that I removed a few of the larger images from my slideshow, because I decided that they weren't really worth the wait. I also changed the way the slideshow worked on that site to pick new images for each new page request. That means the site's users probably won't notice the missing images, but will very likely notice the improvement in speed.

Do you have any special circumstances that are effecting the speed of your site? I'd love to hear about them. Drop me a line via the Contact Form.

Attachments: