Optimizing Your Drupal Site

Drupal is a widely used open-source CMS platform that is becoming increasingly popular by the day. I have personally used Drupal on/off since v4 and have seen it mature over the years into my preferred content management system. Here at the Rackspace Cloud we speak to hundreds if not thousands of new customers and prospects every month that either want to migrate their existing Drupal sites into the Cloud or start fresh with Drupal.

Improving performance is always a concern with any site and after working with countless Drupal installs I have identified a few tools and options that can very quickly make a very noticeable difference in your sites performance. These tweaks are not specific to the Rackspace Cloud platforms and should be considered by any Drupal site admin on any hosting solution. They will not only improve the performance of your site but also reduce back-end resource utilization such as CPU and memory or lower compute cycles on Cloud Sites for example. This is achieved through various levels of static page caching and a highly optimized database. Let’s take a look at the options.

Before we look at any third party modules lets examine what Drupal has built-in that can help. Navigate to Administer –> Site Configuration –> Performance. This section allows users to enable/disable specific caching functions included in Drupal CORE. Here are my recommendations for a typical Drupal site:

  • Caching Mode: Normal
  • Page Compression: Enabled
  • Block Cache: Enabled
  • Optimize CSS Files: Enabled (use in production only, not during theme development or customization)
  • Optimize JavaScript Files: Enabled (use in production only, not during theme development or customization)

Next I highly recommend setting up a cron job to run the Drupal cron.php file regularly, I typically run it once per day but it depends on your site (heavy traffic sites might want to run it more often). While this may not have a direct performance impact it is good general practice as executing this script performs many maintenance tasks including cleaning up old log files and checking for updates. Setting up a cron job is pretty simple and some hosting platforms such as Cloud Sites can make this a point/click configuration. Reference this page for more information on how Drupal uses cron and setup instructions.

Now, lets take a look at two third party modules that I have used for sometime that can have a dramatic impact on your site:


Boost provides static page caching for Drupal, similar to how WP Super Cache works for WordPress. This module works extremely well if your site received mostly anonymous traffic. The developers make this module a breeze to set up and configure and I’ve tested it across many platforms including a dedicated Linux server, Rackspace Cloud Sites & Cloud Servers and even a few shared hosting platforms. Boost also includes partial support for Nginx, Lighthttpd and even IIS 7 (Apache is fully supported). Let’s walk-through the set up:

*Note, Boost requires cron and clean-URLs to be enabled FIRST*

  1. Download Boost here: http://drupal.org/project/boost
  2. Extract and upload to your Drupal /modules folder
  3. Navigate to Administer –> Site Building –> Modules
  4. Enable Boost
  5. Navigate to Administer –> Site Configuration –> Performance
  6. Notice the new options for ‘Boost’ on the top navigation menu, click Boost Settings
  7. Review and adjust any settings necessary (I generally stick to the defaults)
  8. Click ‘Boost htaccess rules generation’ in the top nav menu
  9. Copy the automatically generated htaccess rules and paste them in your htaccess file, see below:
# RewriteBase /
#Rewrite URLs of the form 'x' to the form 'index.php?q=x'

Boost should now be up and running. Be sure to check your Administer –> Reports –> Status Report page for any errors.

DB Maintenance

The DB Maintenance module optimizes administrator selected tables in your Drupal sites database during the regular cron.php executions. Keeping your database optimized is one of the easiest ways to ensure a smoothly operating site on any platform and is essential if you want to scale your site effectively for high traffic. Installation is fairly quick and easy:

  1. Download DB Maintenance here: http://drupal.org/node/41588
  2. Extract and upload to your Drupal /modules folder
  3. Navigate to Administer –> Site Building –> Modules
  4. Enable DB Maintenance
  5. Navigate to Administer –> Site Configuration –> DB Maintenance
  6. Select tables in the Drupal database that you wish to optimize during the regular cron execution and enable logging if you prefer
  7. Save and thats it!

It is suggested to keep your selections to tables where there is a lot of data movement such as accesslog, cache, sessions, and watchdog. You can always make a separate and more infrequent cron as part of your regular server management if you want/need to optimize your node tables.

CDN Integration

The final tip I’ll leave you with is one of the most important and that is serving your static content from a CDN platform. There are many options and one of the easiest and most cost effective to leverage is Cloud Files from the Rackspace Cloud, which has built in CDN integration from Limelight Networks. Off-loading your static content such as images, video, audio, documents, etc to a global content distribution network not only decreases even more load on your hosting platform but it makes site load times significantly faster by serving this content as close as geographically possible to your site visitors (local or close to local data centers).

Uploading content to Cloud Files and enabling CDN distribution takes only a few seconds and is the preferred method for embedding static content, especially large video and audio files. Currently there are a few Drupal modules in development that support Cloud Files and other storage/CDN platforms on varying degrees but none that I’m comfortable mentioning just yet. Once these mature it will only make using these platforms even easier.

Deploying these tips and modules should have a significant impact on your sites performance. There are countless other ways to further optimize your site in addition to this so don’t hesitate to explore other options as well. I hope this is helpful to new Drupal users and even seasoned noders alike.

If you found this article helpful or have anything to add please leave a comment below, I’d love the feedback!

P.S. Looks like I’m going to miss DrupalCon this year for the first time in a few years, I’ll be enjoying my Honeymoon instead. Too bad they moved it to late April. I’ll look forward to 2011!

%d bloggers like this: