Performance Modules

Drupal Version
Tags

There are also quite a few modules that attempt to cache resource-heavy actions on Drupal.

Getting Started with Performance Module

For most websites, core Drupal caching should be sufficient to keep CPU/memory usage down and keep your website running smoothly. However, for larger and more complex websites, additional caching and optimization will be needed.

For your specific website (and its use cases, structure, and workflows), please browse through the modules below and see which module(s) may work for your website. 

Advanced CSS/JS Aggregation

Availability: Drupal 7, Drupal 10

From the module's Drupal.org page:  AdvAgg allows you to improve the frontend performance of your site. The performance benefits are achieved by using some of the features found in AdvAgg and its sub modules. Out of the box AdvAgg's frontend performance will be similar to cores.

Boost

Availability: Drupal 7

Boost provides static page caching for Drupal enabling a very significant performance and scalability boost for sites that receive mostly anonymous traffic.  For shared hosting this is your best option in terms of improving performance.

  • Boost is not recommended for large websites (nodes >= 1000), as the caching process will take up the websites' allotment of CPU cycles. This will slow down the website to be unusable for end-users.
  • Boost can be used alongside Memcache API and Integration
  • No configuration for Boost is necessary beyond installing and enabling the module. 
  • Core caching in Drupal must be disabled for Boost to work properly

CDN

Availability: Drupal 7, Drupal 10

CDN provides easy Content Delivery Network integration for Drupal sites. It alters file URLs, so that files are downloaded from a CDN instead of your web server.

Before you begin, you will need to select a CDN provider. CDN have different costs and features depending on your needs. 

  • These CDNs are currently used on campus:
    • Keycdn.com - Used by the Office of International Education (Jimmy Kriigel)
      • http://oie.gatech.edu
      • http://pacific.gatech.edu
      • http://oxford.gatech.edu
  • This module is best used for websites with lots of traffic and lots of images and/or locally hosted videos.
  • KeyCDN has made a CDN Drupal Integration Tutorial available.
  • The CDN module has TEST Mode.  If you don't want to use the CDN to serve files to your visitors yet, but you do want to see if it's working well for your site, then enable testing mode.  Users will only get the files from the CDN if they have the permission to "Access files on CDN when in testing mode".
  • The "Far Future expiration" option doesn't work with the IMCE module.
    • Update: IMCE has a patch in their dev branch for this issue.
  • You can manually flush a CDN cache file by having the Display statistics Shows enabled and scrolling down to the bottom of the page and selecting "Touch" to purge the file.

Entity Cache

Availability: Drupal 7

From the module's Drupal.org page:  Entity cache puts core entities into Drupal's cache API.  Due to the entity loading changes in Drupal 7, no core patches are required.

Don't bother using this module if you're not also going to use Memcache API and Integration or Redis – the purpose of Entity Cache is to allow queries to be offloaded from the database onto alternative storage, and there are minimal, if any, gains from using it with the default database cache.

Memcache API and Integration

Availability: Drupal 7

This module provides integration between Drupal and Memcached with the following features:

  • An API for using Memcached and the PECL Memcache or Memcached libraries with Drupal.
  • Memcache backends for the following systems (all drop-in):
    • Caching (memcache.inc)
    • Locking (memcache-lock.inc)
    • Sessions (memcache-session.inc) (D6 only)
  • A module that provides a comprehensive administrative overview of Drupal's interaction with Memcached and stats.
  • A set of tests that can be run to test your memcache setup.

Memcache is ideal when there are lots of database reads and writes, as it is a cache for the data layer (this is also why it can so easily whitescreen your site when things go wrong). This article does a decent job of explaining the "whens" and "whys" of APC, Varnish and Memcached.

Recommended Settings

After enabling the memcache module, add this text to the bottom of your settings.php:

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
$conf['memcache_stampede_protection'] = TRUE;
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
$conf['memcache_servers'] = array('localhost:11211' => 'default');

You will need to adjust the module directories if your module is installed in a different directory.

Troubleshooting

In some cases, Drupal will white-screen after settings.php is edited to reflect the new memcache settings. If this occurs, please check your error log on Web Hosting.  If you see a 'Fatal Error', follow the directions below (taken from this Drupal.org thread):

  1. Backup your website.
  2. Download registry_rebuild and upload to sites/all/modules.
  3. Run registry_rebuild by navigating your browser to: [yourdomain]/sites/all/modules/registry_rebuild/registry_rebuild.php
  4. If no errors show up, your registry has been rebuilt.
  5. Delete the module from the sites/all/modules directory.

Varnish HTTP Accelerator

Availability: Drupal 7

Varnish HTTP Accelerator provides integration between your Drupal site and the Varnish Cache, an advanced and very fast reverse-proxy system.  Basically, Varnish handles serving static files and anonymous page-views for your site much faster and at higher volumes than Apache, in the neighborhood of 3000 requests per second.