Performance Tuning your Drupal Install

Your site has been skinned, modules are installed for all the required functionality but your site is running slow, this post will run you through some things you can look at to speed up your Drupal install.

 

Devel Module

Download the Devel module for your version of Drupal, uncompress and upload to the modules directory of your site. Enable the Devel module in your sites administration section and on the modules configuration page activate the options “collect query info” and “display query log”. You may also want to turn on the “page generation timer” and the “display memory usage” option.

After activating the query log you will see all of the SQL queries that where executed in order to generate the page down the very bottom. Using this list you may like to disable any modules which are ineffiecient, but going through what the queries relate to.

The page generation timer is handy when making changes to benchmark what effect they are having on the speed of your site.

 

Block Cache Module

Another module you may want to look at to improve your site performance is Block Cache this module as the name suggests caches the blocks on a page, this module has been included in the Drupal Core as of version 6 but is available as a seperate download for 5.x versions of Drupal. In my case installing and enabling this module sliced around 100ms on average off my page generation time.

 

Boost

This module will cache your pages as static html files enabling huge performance increases for sites with large amounts of anonymous traffic. Each time the Drupal Cron file is executed the cached pages are discarded and recreated when the next visitor requests a page.

 

MySQL Query Cache Optimisation

MySQL query cache stores the results of a SQL query in memory, aftwerward if the results of a cached query is needed MySQL simply serves the result directly from memory without executing the query again. Fine tuning the query cache will have a massive effect on the speed of your site unfortunately this option is only available to those that have complete control of their server environment i.e not a shared hosting environment.

There are two ways you can go about tweaking the MySQL query cache, if you have SSH access to you server you can simply login via a terminal and edit the values for the query_cache_limit & query_cache_size options in the my.cnf e.g

pico /etc/mysql/my.cnf

Be sure to restart MySQL after making any changes to the configuration file.

The second way to tweak these values if you don’t have shell access but have local GUI access (Windows etc) on the server you can use the “MySQL Administrator” program to change the values for your query cache. If you don’t already have this program you can download it free of charge from the MySQL website.

Using the program to connect to the MySQL service, click on the “Startup Variables” option in the left hand column, then select the performance tab at the top of the screen. Then select the Cache Size check box to enable the setting, and enter your new value, then apply the changes and restart the MySQL service.
You may have to play around a bit with the query cache values to find something that works for you, as the cache size is going to be limited by how much memory you server has available to store query results.

Hopefully after install the modules to cache and playing around with the query cache for MySQL you will see some dramatic improvements in the speed of your Drupal site…. Good Luck !!!

 

One thought on “Performance Tuning your Drupal Install

Leave a Reply

Your email address will not be published. Required fields are marked *