On a Debian Jessie server (Nginx, PHP 5.6, Zend Opcache
), I installed Apcu, Redis, Varnish. I also installed APCu, Chained fast backend, Redis and Varnish modules.
In order to make these caching backends play together with Drupal 7, what is the correct backend for each cache bin?
The documentation says :
Because chained_fast backend will mark all the cache entries in a bin as out-dated for each write to a bin, it is best suited to bins with fewer changes.
How do I take care of that recommendation ? Is that correct to put APCu as $conf['chained_fast']['fast_backend']
or is Redis faster ? Between the 20 and more tables, how can I estimate which cache bin should be set to Redis or APCu? Last, shall I only set cache_page
for Varnish or is cache_panels
a good candidate also for Varnish if all my pages are built with panels?
At the moment this is my settings.php
cache part:
//Cache backends
$conf['cache_backends'][] = 'sites/all/modules/contrib/apcu/apcu.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/chained_fast/chained_fast.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/varnish/varnish.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';
// Chained fast settings
$conf['chained_fast']['fast_backend'] = 'DrupalAPCuCache';
$conf['cache_default_class'] = 'ChainedFastBackend';
// Related Varnish settings
$conf['reverse_proxy'] = TRUE;
$conf['cache'] = 1;
$conf['block_cache'] = 1;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 86400;
$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
$conf['omit_vary_cookie'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE; // Don't bootstrap the database when serving pages from the cache.
// Redis settings
$conf['redis_client_interface'] = 'PhpRedis';
$conf['redis_client_host'] = '127.0.0.1';
$conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc';
$conf['path_inc'] = 'sites/all/modules/contrib/redis/redis.path.inc';
// Cache bins configuration
$conf['cache_prefix'] = 'vts'; // Unique prefix for each site
$conf['cache_class_cache_entity_node'] = 'Redis_Cache';
$conf['cache_class_cache_entity_user'] = 'Redis_Cache';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['cache_class_cache_panels'] = 'VarnishCache';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache'; // The 'cache_form' bin must be assigned to non-volatile storage.
cache_
. Each of those is an answer. Do note that only memcache and apcu are applicable to what you're asking as there are implementations written specifically for Drupal's cache system. Varnish is a different kind of cache and opcache is irrelevant here