The Boost module

Date: Mon Nov 05 2007
The Boost module is most excellent. It makes page requests for anonymous users to come directly from a cached file on the file system. Since it ensures there are zero requests to PHP, the site runs at the full speed of your webserver. For anonymous users. For logged-in users their page requests still go to Drupal.

It steps in ahead of any page request and checks whether a cached page exists. If so it returns that cached page, otherwise it requests the Boost module to create a cached page.

The implementation and installation requires some geeky skills.

The module requires modifications to the .htaccess file, and this is the trickiest part of the job.

Inside the module is a htaccess directory containing default.txt and boosted.txt. The default.txt contains an htaccess file very much like the default one distributed with Drupal. I ran a diff between these files to see what they did:

diff -c htaccess/default.txt htaccess/boosted.txt 

You see they added a section of lines. Since these are instructions to the mod_rewrite Apache module, er, while that's a very powerful module it's also very complex. I don't pretend to understand it but the point is if you copy those added lines into ones htaccess file it enables the boost module features.

After running the above command you will see some lines marked with '+' signs. Those are the added lines. It also shows you where within the .htaccess file to add these lines. One could simply copy boosted.txt and use that as your .htaccess file but there is a consideration that the .htaccess which came with the Drupal version you are using is different from the base .htaccess file they assumed. In my case I've installed the wghtml module meaning my .htaccess is nonstandard anyway.

What I did is to copy the added files into my .htaccess, inserting them AFTER the uncommented rewrite rules. What that means is there is a section surrounded with '<IfModule mod_rewrite.c>' and ending with '</IfModule>'. Within that section there are several rules most of which are commented out, but one starts with 'Rewrite current-style URLs'. I inserted the added lines for Boost just after those lines. In my case since I'm using wghtml, the boost lines are added after the wghtml lines. The ordering is:- 0) <IfModule..>, 0.5) commented lines 1) Drupal original lines, 2) lines for wghtml, 3) lines for boost, last) </IfModule>.

Once the .htaccess lines are inserted you can a) turn on the module, b) go to Administer / Performance and see that Boost settings are available. Simply enable the Boost module and define a directory where it can store it's cache. By default the cache directory is 'cache' but if you like some other name use that. Just make sure to change the .htaccess lines to reference this other directory, rather than referencing 'cache'.

The final step is to start browsing your site. You'll see the first page request is much slower than normal but that following requests are much faster than normal.