/
Redis cache configuration on Pantheon

Redis cache configuration on Pantheon

Redis provides an alternative caching backend for Drupal, taking that work off the database, which is vital for scaling to a larger number of logged-in users. It also provides a number of other nice features for develoeprs looking to use it to manage queues, or do custom caching of their own.

Particularly, it does a really great job of speeding up the content editing experience for logged in users quite a bit and makes Panopoly/the IPE much, much zippier with very little work.

See the docs here: 

Configuration

  1. request that Pantheon enable redis via a help ticket
  2. install drupal redis module
  3. In settings.php we drop in

    /**
     * Perform web and drush operations on Pantheon
     * see http://helpdesk.getpantheon.com/customer/portal/articles/708588
     */
    if (defined('PANTHEON_ENVIRONMENT')) {
     
      // Use Redis for caching on TEST and LIVE
      if (in_array(PANTHEON_ENVIRONMENT, array('test', 'live'))) {
        $conf['redis_client_interface'] = 'PhpRedis';
        $conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';
        $conf['cache_default_class'] = 'Redis_Cache';
        $conf['cache_prefix'] = array('default' => 'pantheon-redis');
        // Do not use Redis for cache_form (no performance difference).
        $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
        // Use Redis for Drupal locks (semaphore).
        $conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc';
      }
     
    }
  4. to access Pantheon redis, you will need local command line tools.
    this is easiest with homebrew on OS X:

    $ brew install redis

    or you can download at http://redis.io/download for all OSes.

    To install with Docker:
    docker pull shopigniter/redis-cli


  5. Once install you will need to log in using the credentials from the pantheon dashboard
    to flush the cache on DEV.
    This is useful so that we have a baseline for testing speed gains and debugging. 

    $ redis-cli -h XXX.XXX.XXX.XXX -p XXXX -a xxxxxxxxxxxxxxxxxxxxxxxxxxx
    > flushall
    
    $ docker run -i -t --rm=true shopigniter/redis-cli -h XXX.XXX.XXX.XXX -p XXXX -a xxxxxxxxxxxxxxxxxxxxxxxxxxx
    > flushall

 

External docs

Related content

Terminus Command Line Tool
Terminus Command Line Tool
More like this
High Performance LAMP based Wordpress on DigitalOcean
High Performance LAMP based Wordpress on DigitalOcean
More like this
CloudFlare CMS Setup
CloudFlare CMS Setup
More like this
Hosting a Static Site on Pantheon
Hosting a Static Site on Pantheon
More like this
Site Pre-Launch QA Checklist
Site Pre-Launch QA Checklist
More like this
Testing Website Performance with New Relic
Testing Website Performance with New Relic
More like this