Every Drupal Site Should Be Using Boost

Every Drupal site-- whether 6, 7, or (in the future) 8, should be using the Boost module rather than the default caching system.  If you've never heard of the Boost module, then you're in luck-- that's what the rest of this blog post is about!

 

Drupal - Slow and a Memory Hog!

When a visitor comes to your drupal site, several things have to take place.  Your web server (probably Apache) realizes it's a request for Drupal.  It then hands off execution to PHP.

PHP (through Drupal's bootstrap) must then include() and execute dozens or even hundreds of .module, .inc, and .php files from the various modules you have installed.

Those modules might make dozens or hundreds of calls to your database, gathering all the data needed to display the page to the user.

Finally, the HTML is created and handed down to the user's browser for display to the user.

As you can see, this is a slow and memory-intensive process!  If your site is even remotely popular, it can slow down your server or even cause you to run out of memory on the server.  Never a good thing.

 

The Solution: Boost module

The Boost module, available for both Drupal 6 and Drupal 7 sites (and probably 8, when it comes out), causes your various pages to get cached as static HTML files in a special location of your server.  Plain HTML files are MUCH faster to serve to the user, as there are no PHP or database calls.  It's also much easier on your RAM.

The user is none-the-wiser, either.  Your URLs do not change and the user generally has no idea that they are seeing a cached page.

And don't worry-- this only affects anonymous, non-logged in users.  Logged in users, including yourself, will never get a cached page, always the live pages.

The cache can be set to automatically expire and clear when you save changes to your nodes.

Works with node pages or with Views.

 

Setting It Up

Setup is actually much easier than you might think.  Once you install the module, go to the settings page to configure.  The only "tricky" thing you will need to do is copy and paste a bit of text off the settings page and into your .htaccess file, at the root of your drupal site.  The module provides simple instructions telling you where to do this.

You might need to create a /cache/ directory under your drupal dir (ex: /drupal7/cache). And make sure to chmod the directory with 775 to make sure it can be written to and read from easily, as this is where all of your site's cache files will get stored.