10

I'm running a Magento EE 1.12.2 (equally in CE 1.7.2) where we have Redis for caching (Cm_Cache extension, Redis v 2.2.12), but we use Memcache for session storage.

Redis is not supported out of the box on these Magento versions. So my concern here is:

  • Is it worth the hassle to get session storage into Redis in terms of effort vs. speed improvement?
  • Isn't Memcache just as good or maybe even better?

In this project we have large session files as we need to store third-party XML files into the session, so optimizing session read and writes can have a considerable impact.

From local.xml:

<session_save><![CDATA[memcache]]></session_save>

And:

<cache>
    <backend>Cm_Cache_Backend_Redis</backend>
    [...]
</cache>
11

As per as my concept Redis is most good:

Memcached is Free & open source, in-memory key-value store, high-performance, distributed memory object caching system.

Redis is an open-source, networked, in-memory, key-value data store with optional durability.

Because of

  1. Memcached is a volatile in-memory key/value store. Redis can act like one (and do that job as well as Memcached)
  2. It's architecture is suitable for faster save data.
  3. Data fetch faster
  4. Persistence to disk, by default
  5. Values up to 512MB in size (Memcached limited to 1MB per key)
  6. Built in clustering

Redis doesn't support LRU or any similar policy for handling overload Redis doesn't support CAS (check and set) which is useful for maintaining cache consistency - see What are the most common sources of Memcached cache inconsistency? (though there is a SETNX operation that makes this unnecessary)

enter image description here

More details: Stackoverflow "Memcached vs. Redis?"

Some details with Redis faster data support: Redis.io

  • Ok, it's a nice comparison and the link provides much information of differences between the two. But is is actually worth the try when already using Memcache to change it to Redis? – 7ochem Mar 20 '15 at 14:30
  • yes.it only woth when you will use redis...You use redis on Magento EE 1.12.2.be – Amit Bera Mar 20 '15 at 14:34
  • 7ochem, have you give me down vote? – Amit Bera Mar 20 '15 at 14:35
  • 3
    Great contribution. was having same question. using redis now. working superbly on 1 store, but a little less effective on another. sure to try out memchache as well. @AmitBera can you stack memcache + apc or redis + apc and how would a local.xml look like then. – Kay Int Veen Mar 20 '15 at 15:05
  • 3
    "Redis doesn't support LRU or any similar policy for handling overload" - you may want to strike that, unless you mean something different. Also, since the OP is looking to migrate sessions instead of cache to Redis, session eviction is ideally time-based not size based so LRU is not a bonus. – Melvyn May 6 '15 at 17:03
6

CM Redis Cache in 1.7.2 is not a hack, Magento just added the code by default to 1.8+ because it works so well and is implemented easily.

Redis has support to have cache and session in the same server instance because of databases. In memcached you would probably start multiple instances of memcached.

Memcached also has the possibility to write to disk, this can be used to save sessions after a restart of the service. When writing to disk, memcached can give errors on the your site because it will lock for a few moments. Redis will handle this better as some other questions on this Stack already shown.

So I would recommend Redis over memcached.

5

This unfortunately isn't a black and white answer. So, I'll give you the pro's and cons:

Memcache:

  • hardcoded data limit (don't discard this issue, admin sessions can easily grow beyond it)
  • stalls when saving to disk
  • slightly worse performance
  • Magento extension has no bot-defense

Redis:

  • Locking issues in Session::read in some stores, caused by concurrent access to the session.
  • Support for multiple databases in one instance, but with some caveats.
  • Magento extension has support for defending against bots and comes with migration scripts
  • Magento extension has support for snappy compression algorithm
  • More actively maintained code base

Now, if speed is your only concern, then simply run a load test. A free account at Blazemeter gets you 50 virtual users to work with, which should be enough to measure the differences.

protected by Amit Bera Apr 27 '15 at 19:54

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.