4 ms·
what about using redis for distributed locks? (assuming you are not using redis cluster)
by AznHisoka 10y ago
what about using redis for distributed locks? (assuming you are not using redis cluster)
- helper 10y agoI personally wouldn't use redis for anything besides a cache.
- fgasparini 10y agoWhy not? It has a WAL persisted to disk at a desired interval. It provides the same durability levels of most databases. http://redis.io/topics/persistence http://redis.io/topics/persistence
- helper 10y agoLet me be clear, I think redis is a well engineered piece of software and I have been constantly impressed with the way antirez runs the project. Specifically for the question of a locking service, I need more availability than what a single node can offer. I'm not sure if you are advocating for using redis cluster as a locking service, but since it intentionally doesn't offer write safety during a partition that does not seem advisable.
- SEJeff 10y agohttps://aphyr.com/posts/283-jepsen-redis https://aphyr.com/posts/283-jepsen-redis
- craz 10y agoYou'll want to use a library that implements Redlock: http://redis.io/topics/distlock http://redis.io/topics/distlock
- SEJeff 10y agoYou really don't want to use redlock: http://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html http://martin.kleppmann.com/2016/02/08/how-to-do-distributed... Antirez's rebuttle didn't really rebuke martin's overall theory that redlock is a very bad locking algorithm: http://antirez.com/news/101 http://antirez.com/news/101
- dpark 10y agoDid anyone else ever publish a meaningful response? I thought Antirez's response was reasonable but I also recognize the inherent bias. I'd love to see responses from other experts, ideally written such that non-experts can reasonably understand.
- SEJeff 10y agoI recall several people on twitter (I follow a lot of distributed systems people / cs professors as it is part of my job to build these things) who agreed with Martin's analysis.
- dpark 10y agoI'll have to see if I can dig some of the responses up. It bugs me that I still don't know if this algorithm is actually safe.
- SEJeff 10y agoHonestly given Antirez's response I'm genuinely surprised no one has written a TLA+ or similar formal verification proof. Then the outcome is binary; either redlock is sound and works as expected, or it is not. Amazon's AWS Architect, James Hamilton is a big fan of this approach, as are most of the heavyweights in distributed systems: http://perspectives.mvdirona.com/2014/07/challenges-in-designing-at-scale-formal-methods-in-building-robust-distributed-systems/ http://perspectives.mvdirona.com/2014/07/challenges-in-desig... EDIT: prefaced URL with http
- nurettin 10y agoThanks, I learned the fencing token lock algorithm from this.