Optimize Drupal: 5 Simple Steps

March 1st, 2011 Leave a comment
Like the article?
Speedy Drupal

Drupal, along with Joomla, is one of the heavyweights in the CMS realm today. It is feature-filled, robust, and customizable with tons of user-created modules that enhance and add functionality to it.

It is also, however, subject to that CMS problem that plagues every sysadmin: Speed. CMSs like Drupal suffer from being complex pieces of software; the number of functions and queries the system uses is far greater, naturally, than a straight HTML page or a simple PHP site. As a result, the performance may suffer, especially when running on a VPS or shared hosting and responding to many hits per day. Unfortunately, not everyone who runs Drupal can afford to simply upgrade the hardware every time their Drupal install starts to slow down: for many sysadmins, scaling out reaches that critical point where they need the traffic but don’t quite have the resources to bump up the hardware their web servers reside on. Recognizing that need, here are some simple tips to get Drupal running quite a bit quicker on your system!

1. Use MySQL Instead of PostgreSQL

I’m sorry to all the Postgres fans out there, but the hype about MySQL’s speed is true (at least in this case). Using MySQL with MyISAM tables, performance against PostgreSQL is measurably faster: it can shave tens of milliseconds off your page load time, which can be crucial when a site is under heavy load.

I know there is the Postgres contingent out there that will come back at me with all sorts of reasons why Postgres is better than MySQL, and they may be right, but the fact of the matter is that when it comes to wringing out every last bit of speed from Drupal, MySQL’s your database of choice.

2. Disable/Remove Modules You Don’t Need

Drupal is a wonderfully customizable CMS, but that “customizability” can come at a price: a ton of third-party modules can seriously bog down your system, especially if they are shoddily written or don’t scale out well. Every now and then, go through your module list and check out what modules you have enabled; chances are, you’ve got more enabled than you really use and you’re wasting precious system resources for a module you downloaded and forgot.

3. Enable Drupal’s Cache

Drupal has a really friendly cache system that you can enable right from the administration screen. Enabling both page cache and block cache will speed up your site considerably!

Drupal also has options for aggressive caching. This will eke out all the performance possible from your Drupal site, but at the cost of compatibility: many modules aren’t compatible with aggressive caching, and Drupal kindly informs you about them if you try and enable aggressive caching. For those needing the speed, enable it, but don’t say I didn’t warn you: any bugs or instability afterwards is probably a symptom of a module not playing well with aggressive caching.

4. Use a PHP Accelerator (APC or eAccelerator)

This entry is maybe a cheat, as it’s not Drupal-specific, but it’s worth to mention all the same. PHP op-code accelerators, such as eAccelerator and APC, are vital for a busy Drupal site. In some cases, you can almost double or triple the amount of requests your Drupal site can handle by implementing an op-code accelerator.

In practice, all of the accelerators are more or less the same: APC tends to be the fastest, but not by much, and so I recommend you go with whatever accelerator you’re most comfortable with. Installing one is key to handling more load on a Drupal server, and if you’re watching your load averages inch up I highly recommend getting one of these in as soon as possible!

5. Enable Bandwidth Optimization

This one may seem almost too easy, but Drupal has the ability to aggregate and compress JavaScript and CSS files. Doing so reduces not only load averages but bandwidth as well, since the client-side machine is downloading one aggregate script or style sheet as opposed to the multitude that existed before. Depending on how script and style-heavy your site is, enabling this feature may show tremendous speed gains because of the content aggregation. Even if your site is not very script-heavy, it may be worth it to try it out. I’ve never heard of any problems involving the bandwidth optimization, and it can only make your site faster!

So there you have it – 5 tips to speed up your Drupal install! None of them are, by themselves, a silver bullet for speed problems; however, if you combine all five tips, it’s very likely you’ll see a great deal more speed and performance roaring out of your Drupal box, a blessing for any beleaguered sysadmin who doesn’t have the funds to throw more hardware at the problem!

Help us spread the word!
  • Twitter
  • Facebook
  • LinkedIn
  • Pinterest
  • Delicious
  • DZone
  • Reddit
  • Sphinn
  • StumbleUpon
  • Google Plus
  • RSS
  • Email
  • Print
If you liked this article, consider enrolling in one of these related courses:
Don't miss another post! Receive updates via email!

Comment