29

It seems silly to compare these two servers considering that they're meant for very different things. But if you think about it, they can do lots of similar things: store configuration data, distributed locking, queueing, etc.

I've got an instance of Redis that I'm using for some production-related things, but would like to do some simple synchronization between servers (mostly configuration changes that don't require pushing up code and simple locking between servers). What does Zookeeper give me that Redis wouldn't?

3

1 Answer 1

28

We use both Redis and Zookeeper at work so this is from first hand experience

Redis is fast; really, really fast. It is also immediately consistent, so it's good for fast moving data sets. The downside is that, running on one server, if it fails then you lose write access until another server takes it's place. Replacing the server is a manual operation unless you automate it yourself. (You can still get read access to your data if you configure a slave instance).

Zookeeper also features immediately consistency. It's not half as quick, but it will recover automatically (where possible) in the face of failure, so if you need continuous write access, even when your servers fail on you then you'll want to use Zookeeper.

My advice is, use zookeeper for coordination: tracking which nodes are active, leader election amongst a group, etc. Use redis for datasets that need fast writes but where the occasional outage isn't a disaster. Hit counters for web pages for example.

4
  • I am currently working on a project and was thinking that zookeeper was going to be the way to go. If you have any more information that you can share somewhere would be wonderful. We are dealing with multiple ad exchanges and tracking around 4 billion+ events a day. We are looking to redesign our front end servers and were looking at zookeeper to store information about tracking counts, minimal weighting etc. I can attest to the speed of redis but my experience it lacks a hierarchial structure that we were looking to use with zookeeper. Has your stance changed on the 3 years since the 2012? Aug 3, 2015 at 17:44
  • @ChrisHinshaw I am facing the same issue. Considering both Redis and Zookeeper for a distributed resource manager which requires both distributed locks and perfomance. Do you have any feedback? Apr 28, 2016 at 14:28
  • 1
    I am finishing up a rewrite of this now. I went with redis due to the speed. There were some performance problems with zookeeper but I don't recall the issues. We are storing timeseries data based on metrics and counts. I am using lua scripts to update the counts for each of the time periods to limit the number of calls. An example is that we have a hash key for bid requests in the form of br:1:2:3:4 where the numbers represent a hierarchy of metric:agency:advertiser:campaign:ad. In the hash the values are year:month:day:hour:minute. In my lua script I would update the counts for each Apr 28, 2016 at 19:18
  • of the time slices. So my script splits the y:m:d:h by colon and updates the totals for each slice. This way I can use an hscan or fetch a list of keys for any timeslice. The most important thing in redis is to come up with a hierachial model for the keys. At some point in the future I would like to move all of this to spark rdd's with a cassandra store. If I had the time, I would implement spark streaming to benchmark that. I think it would be on par with redis and gives the flexibility of doing analytics. Apr 28, 2016 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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