Optimising Drupal for Server Performance

Over the past month ImAFish has been experiencing a number of issues with server performance, pages were often slow to load and 'MySQL server has gone away' errors were becoming common. At first I thought it was an issue with the server but after discussing it with my hosting company it turned out ImAFish was using over 10% of the server CPU/Memory power.

I made the following changes to my Drupal install to improve performance:

Remove as many modules as you don't need. 

ImAFish is primarily a blog, I had additional modules for user profiles, currency conversion, flash charts and plotting time lines to name a few. This huge bloat was my main cause of problem, by disabling the modules I didn't need or could do without I made instant performance boosts. Drupal makes it very easy to add additional functionality to your site, unfortunately its very easy to bloat your site.

Rerun the Cron Job

My cron job runs every 24 hours however because of the amount of work it had to process (mainly because of the activity stream module) it was often failing with mysql has gone away errors. After removing a number of modules it took a further three runs of the cron job to clear back all the necessary maintenance (such as deleting spam comments in the akismet queue and clearing the watchdog table).

Update Drupal and all Modules

Once I was happy with my modules I updated the core drupal 5 install then the modules one by one - running update.php each time. It's important that you run the cron job before doing this as I was getting further mysql has gone away errors on update.php before I ran the cron job. A set of updated modules also reduced mysql has gone away errors because of various bug fixes.

Reduce the Number of Blocks on a page

I had about 15 different blocks running down the right of a page, I cut this down to 9 to help reduce server load.

Enable Drupal Page Cache

Simply done in performance settings, there are additional options in Drupal 6. 

Disable Statistics Module

If you can do without the statistics module and rely on outside services such as Google Analytics then this will make a small difference.

Further Updates

Upgrade from Drupal 5 to Drupal 6 to make better use of the performance features such as block cache and javascript aggregation.

I had to repair a number of database tables as well in the process, this in turn caused some quite serious data loss on the node_revisions table and I lost a number of my recent blog posts. Fortunately I used the Google Cache to recover this data.

The end result has been a much leaner and faster loading ImAFish site.


Syndicate content

Comments are closed automatically six months after blog posting.