My site's performance is poor. What can I do to improve it?

There are a number of things that you can do yourself to improve your site's overall performance without having to dig into your pockets for a performance review. The two suggestions in this article are simple and do not require much work.

Most notably, ensure caching is enabled. You can do this going to /admin/config/development/performance. Make sure the following options are ticked:

  • Cache pages for anonymous users
  • Cache blocks
  • Aggregate and compress CSS files
  • Aggregate Javascript files

Set the minimum cache lifetime to 15 minutes and the expiration of cached pages to 1 hour (Note: these values are only meant as a guideline. Adjust them to your site's needs).

Next, memcached! Usually our servers come shipped with memcached installed and running, but it's good to double check that it is. To follow the steps below to check if memcached is installed, you will need to be connected to your server.

telnet localhost 11211
version

If you are unable to connect, this is an indication that memcached is not installed. If this is the case and you wish to have it installed, you should raise a ticket in Redmine.

If you are able to connect and see a version number, this means memcached is installed and running on the server, so we highly recommend installing the Drupal Memcache module. Memcached simply stores small chunks of data, such as strings and objects, from results of database calls, API calls or page rendering. After you install the memcache module, enable it from the Modules page or use drush:

drush en memcache

For help on using Drush, check out this FAQ article: How do I use Drush?

Next, you need to edit your settings.php file in the sites/default/ of your site root to include the memcached settings. Put the following lines at the bottom of your settings.php file:

$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';

$conf['cache_default_class'] = 'MemCacheDrupal';

$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

$conf['memcache_key_prefix'] = 'xxx';

$conf['lock_inc'] = 'sites/all/modules/contrib/memcache/memcache-lock.inc';

Change xxx to a more suitable prefix and then save the file.

And there you have it! You can check that Memcache is installed and configured correctly by going to /admin/reports/status. You should see a huge difference in load times now.