Does Redis support strong consistency

Steve Newstead picture Steve Newstead · Dec 3, 2012 · Viewed 18k times · Source

I am looking at porting a Java application to .NET, the application currently uses EhCache quite heavily and insists that it wants to support strong consistency (http://ehcache.org/documentation/get-started/consistency-options).

I am would like to use Redis in place of EhCache but does Redis support strong consistency or just support eventual consistency?

I've seen talk of a Redis Cluster but I guess this is a little way off release yet.

Or am I looking at this wrong? If Redis instance sat on a different server altogether and served two frontend servers how big could it get before we'd need to look at a Master / Slave style affair?

Answer

myanimal picture myanimal · Dec 14, 2012

A single instance of Redis is consistent. There are options for consistency across many instances. @antirez (Redis developer) recently wrote a blog post, Redis data model and eventual consistency, and recommended Twemproxy for sharding Redis, which would give you consistency over many instances.

I don't know EhCache, so can't comment on whether Redis is a suitable replacement. One potential problem (porting to .NET) with Twemproxy is it seems to only run on Linux.

How big can a single Redis instance get? Depends on how much RAM you have. How quickly will it get this big? Depends on how your data looks.

That said, in my experience Redis stores data quite efficiently. One app I have holds info for 200k users, 20k articles, all relationships between objects, weekly leader boards, stats, etc. (330k keys in total) in 400mb of RAM.

Redis is easy to use and fun to work with. Try it out and see if it meets your needs. If you do decide to use it and might one day want to shard, shard your data from the beginning.