Don't Varnish Over the Cracks – Super-fast Drupal for logged-in users – Caching



Don't Varnish Over the Cracks – Super-fast Drupal for logged-in users – Caching

0 1


dont-varnish


On Github dwkitchen / dont-varnish

Don't Varnish Over the Cracks

Super-fast Drupal for logged-in users

Presented by David Kitchen / @dwkitchen

Not Going to Look At

  • Stack Options
  • Database Settings Tuning
  • Content Delivery Networks

Caching

Type

  • By Role
  • By User
  • By Page
  • Anything else

Time

  • 1 second
  • 1 minute
  • 1 hour
  • 1 day
  • 1 week

Entities

Entity Cache

Commerce Entity Cache

Render Cache

Views

Time Cache

Nids vs Content - Football scores view

Panels

Time Cache

Nids vs Content - Football scores view

Redis/Memcache

Redis

Library

PhpRedis Redis cache backend using the well performing PhpRedis PHP extension. Predis Redis cache backend using the standalone Predis PHP library.

settings.php

$conf['redis_client_interface'] = 'PhpRedis';

$conf['cache_backends'][] = 'sites/all/modules/redis/redis.autoload.inc';
$conf['cache_default_class'] = 'Redis_Cache';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

$conf['lock_inc'] = 'sites/all/modules/redis/redis.lock.inc';
$conf['path_inc'] = 'sites/all/modules/redis/redis.path.inc';

Authcache

settings.php

$conf['cache_backends'][] = 'sites/all/modules/authcache/authcache.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/authcache/modules/authcache_builtin/authcache_builtin.cache.inc';

$conf['authcache_builtin_cache_without_database'] = TRUE;
$conf['page_compression'] = 1;
$conf['page_cache_maximum_age'] = 600;

Blocks

Menu

Disabling form-token retrieval

Administration » Configuration » System » Authcache » Form and expand the fieldset Remove form tokens.

search_form
search_block_form
search_api_page_search_form

commerce_cart_add_to_cart_form_*
                        

The Authcache Form module provides means to retrieve form tokens using Ajax or ESI and inject them into a page retrieved from the cache. This mechanism allows us to cache even pages with forms for authenticated users. However this is on the expense of having one more HTTP request hitting the server per form unless the fragment already has been cached in the browser.

Doing this increases performance for loading the form but opens the form for DDOS Attack

If you really want to:

Authcache 2 recipe: Upgrade to Varnish and ESI

Other Modules

Advanced CSS/JS Aggregation

Fast 404

Ultimate Cron

Patches

#1905544 Cache mailsystem_get_classes() between requests

If you have Mailsystem this could be the slowest query on the page.

Live Demo

What could go wrong?

Network Analysis

Blackfire Analysis

Drupal 8

All of this is built in using

Questions

More Information

Presentation https://github.com/dwkitchen/dont-varnish Site Repo https://bitbucket.org/dwkitchen/dont_varnish Enterprise for Everyone Distribution https://www.drupal.org/project/ee
Don't Varnish Over the Cracks Super-fast Drupal for logged-in users Presented by David Kitchen / @dwkitchen