Redis - live setup

Redis - live setup

Intro

We have decided to switch from Memcache to Redis for our Drupal caching in order to:

  • Have cache records persisted to disk and thus avoid load spikes due to multiple records needing to be rebuilt if the in-memory cache is lost for any reason.
  • Get better visibility into how our caching is working. Redis provides much better tools for understanding what is going on.
  • Build for the future. Redis is a more modern software and likely to see more future development and support going forwards.

In our Phoenix live tests (see linked JIRA issues below) we found Redis to be slightly faster when reading and very slightly slower when writing. This should suit as well, as we have far more reads and writes.

Master per-host setup - Live as of May 2015

In this setup, each web server has it's own instance of Redis, for both reads and writes. The Redis instances are not synced with each other. Two weeks after making this change, this setup is proving far more stable than the old master-master-slave setup.

Tools

Redmin

Redmin is a web-based tool for interacting with Redis. We have it installed at the following path and the login details can be found here:

http://www.attraction-tickets-direct.co.uk/custom/phpredmin/public/

This is a useful tool for checking that the master-slave replication is working. You can create a new key on the master and within a few seconds you should be able to read it from all the slaves.

Redis-cli

Redis-cli is a command line tool for interacting with Redis. You can ssh into any of the cache or web servers and type "redis-cli" to connect to the local redis instance.

Some useful commands can be found on the Useful Redis commands page linked below.

Related pages

blog tag: