Subscribe to:

The Kiwi's TaleWitchBlasterDerelict Blow Stuff Up

Drupal optimisations

A couple of months back at the Auckland Drupal meetup, organiser Michael Dance gave an excellent talk on optimising Drupal performance. I thought that it might be useful for me to summarise what I got out of the session, and that it might be interesting to both Drupal users and non Drupal users alike that follow this blog.

Note that these enhancements deal only with optimising performance for anonymous users (Authenticated users is much trickier) and most of these should be turned off during site development.

Optimising the codebase

High level Drupal sites require both maximum performance and maximum stability. The problem with performance and stability is that they are often mutually exclusive, and the core Drupal team is focused on providing stability above everything else.

That's where PressFlow comes in. PressFlow is a custom version of the latest stable Drupal version that is fully compatible (As far as I am aware) with all existing contributed modules, but contains numerous performance enhancements as well.

Optimising the Drupal application

Drupal has several built in performance optimisation settings, but these are turned off by default in order to not interfere with site development.

They can be found under the Administration > Site configuration > Performance menu, and should be turned on when the site goes live. This contains several settings for page caches, as well as optimising CSS and Javascript.

Optimisation at the PHP level

Whenever the web server needs to interpret PHP code, it will take a performance hit.

The Drupal Boost module can bypass PHP (and therefore, Drupal) altogether, by creating cached HTML versions of the pages on your site. When the underlying web server is properly configured, it will use these static HTML versions instead, only running the Drupal PHP code if an HTML version does not exist.

Optimisation at the web server level

It's not a stretch to say that Apache is the most powerful web server software available, but that power comes with a relatively high processor and memory footprint.

For sites requiring better performance, a smaller but highly optimised web server such as nginx might be a better alternative.

Optimisation before the web server level

No matter how optimised, a web server will take a performance hit every time a user directly connects to it.

Instead of allowing direct access to your site, you could direct traffic to a reverse proxy server (Also known as a 'HTTP Accelerator') which will serve the pages on the web server's behalf, only interacting with the web server if it does not have a stored copy of the required page. Varnish is an extremely high performance reverse proxy server that has the added bonus of having a Drupal module for tight integration.

 

Although I don't have a dedicated server, and therefore can't do all of these optimisations, I'll definitely look into at least PressFlow and Boost.

Tags: