Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
    
Redis is not (specifically) for configuration. They're quite different products. – Rein Henrichs Jun 11 '11 at 1:44
3  
Why? We are using PostgreSQL for configuration. What makes configuration so different from business logic? – Dmitry Negoda Jun 11 '11 at 18:03
up vote 16 down vote accepted

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.

share|improve this answer
    
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? – Chris Hinshaw Aug 3 '15 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? – Rafael Saraiva yesterday
    
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 – Chris Hinshaw yesterday
    
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. – Chris Hinshaw yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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