The ultimate guide for faster Drupal: Part 1 Caching

Drupalutvikler, prosjektleder og designer
Drupal performance with Ramsalt

At the Lab section of our name: "Ramsalt Lab" we tried to put Drupal on steroids to test and see how much can we get out of Drupal performance wise and we will now publish a series of blog posts that together make a coherent How-to guide on Drupal performance.

Experience, general web performance and Drupal optimization articles

For gathering all the data in this document, we did some heavy research. We have studied a lot of general website performance, Drupal optimization articles and we have done a lot of tests and put in the organization's over 100 years of total Drupal experience into play. A highlight that we would like to point out is this great presentation in DrupalCon 2018 Nashville that you can download its pdf and take a look for yourself.

Chapters in the "Faster Drupal" blog series

As a starting point, note that it’s a much easier bet to start with a Drupal 8 installation instead of Drupal 7 since you can get much better results built-in. But in many cases, the current project is already on Drupal 7, so we try to cover both cases. Some of the items are, to say the least, “Obvious” but this list is supposed to be as coherent as possible. For most of this, we consider you have full access to your server and can set up the things listed here, so based on that, let’s kick things off with Caching. Then for the second blog article, we will look into asset distribution, CDN, compression, and aggregation. Thirdly we’ll be taking a look at one of the greatest enemies of performance: Images! Fourth step we will cover some techniques for Database/Web Server Tweaks & Improvements and lastly some general tips and HowTo’s for optimizing theming in Drupal.

Improving Caching in Drupal:

  1. Use Redis: Integration of Drupal with the Redis key-value store. It provides cache, lock, and path optional backends
    Redis Drupal module
    Not happy with Redis for some unknown reason? Try Memcache
    For a simple drupal installation, we can take advantage of these two modules:
    Drupal Memcache + Drupal Memcache Storage modules

  2. Use Varnish Cache: If you want to improve the performance of your website without using Varnish is like trying to cook without a pan! Varnish is an advanced and very fast reverse-proxy system. In the common configurations Varnish will handle all caches regarding anonymous page-views, and sometimes even static files and pages for logged in users via per-role-caches and ESI (Edge Side Includes) for your site.
    Varnish Drupal module (not required for caching, but essential for cache purging).
    But hey I’m on shared hosting and don’t have access to any fancy Varnish HTTP cache thingy? Well then use Boost module
    Drupal Boost module

  3. Take advantage of PHP Cache (APC): With APC caching your PHP script executions can run more efficiently, by cutting down on dynamic PHP executions.

  4. Let’s all agree we all love CloudFlare: CloudFlare is a FREE reverse proxy, firewall, and global content delivery network and can be implemented without installing any server software or hardware. At least based on Cloudflare module’s page, on average, CloudFlare-powered websites load 30% faster, uses 60% less bandwidth, and process 65% fewer requests. CloudFlare-powered websites are protected from many forms of malicious activity including comment spam, email harvesting, SQL injection, cross-site scripting, and DDoS (denial of service) attacks.
    Drupal CloudFlare module

  5. The Purge (Not the movie): So by now you cached the hell out of your website and now you just want to change something on your website? The purge module facilitates cleaning external caching systems, reverse proxies and CDNs as content actually changes. This allows external caching layers to keep unchanged content cached infinitely, making content delivery more efficient, resilient and better guarded against traffic spikes.
    Drupal Purge module

  6. Did you know you can cache your views? In Drupal 7 Enable “Views Caching” in each Views manually and in Drupal 8 there’s a module that helps a lot with that.
    Drupal Views Advanced Cache module

  7. Using Panels? Enable Panels caching in each Panel

  8. Drupal 8: Do you like BigPipe in Drupal 8 core? How about some sessionLess BigPiping? (No pun intended)
    Sessionless BigPipe module

  9. Use views with minimum pagination navigation to save some SQL time (just first, previous, next, last links instead of (1,2,3,4,5…). In Drupal 7 you also need to use:
    Views Litepager module

  10. A long cache lifetime can speed up repeat visits to your page, Serve static assets with an efficient cache policy
    Read more on Google developers

  11. Drupal 7: People need to login to your website and you still would like some caching? AuthCache to the rescue
    Authenticated User Page Caching module

  12. Drupal 7: You like Drupal 8 core cache tags and cache max-age? But maybe for Drupal 7?
    Drupal 8 Cache Backport module

  13. Drupal 7: Need different caching per block? Fear not
    BlockCache Alter module

  14. Drupal 7: Already setup Memcache and Redis? Add some Entity Caching
    Entity Cache module

  15. Drupal 7: Render Cache is also quite powerful but has some issues on the cache clearing level, so use with caution.
    Render Cache Drupal module

  16. Consider using Google QuickLink Library if possible. Enables faster subsequent page-loads by prefetching in-viewport links during idle time at the cost of increased page loads for the client.
    Google QuickLink Drupal module

Okay, that was a long list of things to consider/do for just caching, but hey we are here to make something extra performative.

In the next upcoming part that will be published in about a week, we will focus on Drupal Aggregation / CDN / Compression

Latest news

Test intro

 

Einar Ryvarden, digitalsjef, Tidsskrift for Den norske legeforening deler sine beste tips for et godt internt søk på nettsider.

Vi er på jakt etter deg som liker både folk og teknologi, men ikke nødvendigvis har noen teknologiutdanning. 

Yngve W. Bergheim
Yngve W. Bergheim