For somebody who is new to Drupal, I see that there are many resources available on Drupal Caching but I am not sure which of them to use.

  • 1
    We can discuss whether we want a canonical question for this on meta, but I still think it is too broad. And performance improvements can be very context sensitive and not done in a vacuum.
    – mpdonadio
    Jun 20, 2014 at 16:57

3 Answers 3


These are notes from my experiences and might vary from what others experience. I predominantly use LAMP stack and have considered the same in my suggestions.

Thumb rules for caching that I generally follow.

  1. Process Once Use Multiple Times.
  2. Live with stale data when possible
  3. Clear Caches infrequently and keep it very specific.
  4. When possible do the changes at the lowest level in the stack. LAMP - DCCc : Linux, Apache, Mysql, PHP, Drupal Core, Contrib and custom module.

Improve Performance of a Drupal Site (In the increasing order of complexity)

  1. Keep the core updated, contrib module and themes updated. Yes it matters.

  2. Install APC on your server. (Moved to top based on suggestion from Letharion)

  3. Page Caching : admin/config/development/performance Difference between Minimum cache lifetime and Expiration of cached pages

  4. Block Caching https://drupal.org/project/blockcache_alter Caching options for all the blocks.
  5. Aggregate javascript and css files - Front End Improvements https://www.drupal.org/project/advagg
  6. Disable Unnecessary modules. Every module adds to the amount of code that needs to be available for a page load. And it also increases the number of lookups. Wherver possible use a generic module in place of multiple module that does specific functionalities.
  7. Cache Views content - Content aware caching for Views https://www.drupal.org/project/views_content_cache
  8. Disable DB logging - Use https://drupal.org/project/syslog_ng
  9. Reduce 404 Errors - http://www.brokenlinkcheck.com/
  10. Fast 404 Responses - https://drupal.org/project/fast_404 - Try handling at server level.
  11. Client Side Validations - https://www.drupal.org/project/clientside_validation
  12. Compress Image - https://www.drupal.org/project/imageapi_optimize
  13. Lazy Loading of Images - Don’t load unnecessary images - https://www.drupal.org/project/lazyloader
  14. Use Sprite Sheets - https://www.drupal.org/project/spritesheets

  15. Set Minimum Cache Life Time Value to a higher number and use cache clearing modules to clear the caches for specific pages - Whenever I edit/update a node all the page caches for anonymous user are lost

  16. Use Devel Module to watch queries.
  17. Rewrite Views Queries / avoid Views if its a overkill.
  18. XHProf - https://www.drupal.org/project/XHProf
  19. FPM, HHVM.
  20. DB Profiling and Tuning - https://www.drupal.org/project/dbtuner
  21. Use Boost, don't Bootstrap DB if not required. https://drupal.org/project/boost For most of the small to medium sites Boost is good enough and you may not need Reverse Proxies or so.
  22. Use CDNs - https://www.drupal.org/project/cdn Its easy to set up.
  23. If your cache tables are huge use Memcached - If you can install memcached and set up RAM for it, it is not as complex as it sounds.
  24. Etags - Configure Etags properly. https://developer.yahoo.com/blogs/ydnfiveblog/high-performance-sites-rule-13-configure-etags-7211.html
  25. Use Reverse Proxy Server - Varnish(at-least for assets). Helps a lot if most of your users are anonymous.
  26. Compressed transfer - Enable gzip compression
  27. Keep Alive - Use Persistent Connections where possible.
  28. Progressive JPEGS -
  29. CACHING IN CODE - Eaton’s blog is awesome. http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7
  30. Implement Cache Warming - https://www.drupal.org/project/cache_warmer - Cache Warm the pages before the end user hits them.
  31. Master Slave DB Config - https://www.drupal.org/project/autoslave makes it easier for you to set up one.
  32. Database Clusters - https://stackoverflow.com/questions/1163216/database-cluster-and-load-balancing
  33. Load Balancers -http://en.wikipedia.org/wiki/Load_balancing_(computing)
  34. Use heuristic Cache Warming - https://www.drupal.org/project/cache_graceful
  35. Authenticated User Caching - https://www.drupal.org/project/authcache
  • 2
    Excellent answer, but one things that strongly stands out to me, is that you don't have APC at the top. APC is trivially easy to get into place, there are no down-sides, and the gains can be really large. I think it should go to the top. (Maybe with a comment that it's not needed after PHP 5.5 as the optimization finally got integrated)
    – Letharion
    Jun 20, 2014 at 11:57
  • 1
    Maybe also mention something about the easiest gains for caching? If your site requires mostly static content (pages are same for all users, so no logins), then Varnish or Boost provides the largest gains. Jun 20, 2014 at 13:09

The database layer is important. I cover some parts of it and the basics in this presentation http://goo.gl/30yi39

  • Awesome presentation MikeyTown. You are the performance pro :)
    – Gokul N K
    Jun 20, 2014 at 16:12

As a companion to Gokul's answer here's the way I would think about what you want to cache in Drupal (not ordered by complexity):

Caching means speeding up repeated activities.

The big repeat actions involved in a Drupal website are:

  • Calling a webpage
  • Running PHP code to build a webpage
  • PHP calling items from the database

Caching an entire webpage

The biggest caching gains are to be had from finding a way to cache an entire webpage without ever running the PHP code or calling the database.

You can do this with Varnish or Boost. When a user calls a page they return a copy of the page without ever doing a calculation.

However this won't work if parts of the page have to be different (i.e. users login and their name appears at the top).

In order to get that to work you need to look into Authcache.

PHP Caching

You can cache PHP with APC, or if you have version 5.5 or greater then a different cache is built in.

This is done server side and means chunks of your PHP code will be remembered. You're caching PHP for Drupal but you're not technically interacting with Drupal.

Database Caching

Calls to grab information from the database are expensive.

The commonest database caching mechanism is memcache.

This caches database objects in RAM, so instead of making a call to a database object on the harddrive, you just pull it from the RAM which is a lot faster.

  • 1
    Redis is also a great in-memory cache store, at least comparable with memcache in my experience (though memcache probably wins out with clustering)
    – Clive
    Jun 20, 2014 at 15:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.