Redis is an open source, BSD licensed, advanced key-value store. It is also referred as a in-memory data structure that can optionally be used in Magento for back end and session storage. It supports data structures such as strings, lists, hashes, sets and sorted sets. Redis is the most popular key-value database used to boost up Magento. Redis is cache tags supported which enables not to use the slow-level file system caching. Redis caching machanism is highly recommend for Magento performance boost.

Overview

Following are some of the benefits Redis provides for Magento implementations:

1. on-disk save and master/slave replication. (Not supported by memcached).
2. Replication enables high availability by eliminating a single point of failure.
3. Support for PHP session storage.
4. Support for multiple databases using same server instance.
5. Can use different databases for the Magento cache, full page cache (EE only)
6. Supports compression such as gzip, lzf, and snappy.
7. Limits the number of concurrent lock requests before an HTTP 503 (Service Unavailable) error is returned.

Requirements

The following Magento editions support Redis session and back end caching:

1. Enterprise Edition (EE) 1.13+ and Community Edition (CE) 1.8+
2. Redis server version 2.6.9+ available at redis.io
3. Redis extension for PHP version 2.2.3+ (optional, Magento can be run without it)

Installation

  1. Install redis on Ubuntu with APT
  2. OR

    Install redis using yum

    magento-redis

  3. To install PhpRedis (optional)
  4. Enable in-built redis module in Magento
  5. Open magento-root/app/etc/modules/Cm_RedisSession.xml in a your favorite ext editor.

    change value of <active> to true.

    and save your changes.

  6. Configure magento to work with Redis
  7. Open magento-install-dir/app/etc/local.xml

    Add this code for redis Cache Storage

    Following code configures redis cache backend to use database with index 1 to hold full page cache.

    Also see local.xml.additional in app/etc folder for reference.

  8. Clear you cache from Magento admin panel or run command

Verifying Redis server

run command

Response should be PONG. This means redis server has been installed successfully.

Verifying Magento working with Redis cache.

Run command

and reload your Magento homepage.
Some get and set commands will be executed. This shows Magento is communicating with redis server.

To exit monitor mode, press CTRL+C

Verifying phpRedis

This should respond as redis

That’s how we implemented Magento with redis cache.

Test Test Test

Next step would be to do performance test on Magento store.

Also see How to install APC (Alternative PHP Cache) for Magento ( nginx + PHP-FPM )