Magento session storage: Redis vs. Memcached
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
- Memcached is a volatile in-memory key/value store. Redis can act like one (and do that job as well as Memcached)
- It's architecture is suitable for faster save data.
- Data fetch faster
- Persistence to disk, by default
- Values up to 512MB in size (Memcached limited to 1MB per key)
- 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)
More details: Stackoverflow "Memcached vs. Redis?"
Some details with Redis faster data support: Redis.io
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.
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.