4 ms·
I find Redis is very useful when you need fast, temporary access to memory in a distributed system. I have used it several times as a distributed lock, or as st
by aledalgrande 7y ago
I find Redis is very useful when you need fast, temporary access to memory in a distributed system. I have used it several times as a distributed lock, or as storage for real-time computations in a distributed system that only use primitive values, for example aggregating page views into different clusters (hashes or sets in Redis) and then saving the result to DB.
- hmottestad 7y agoIs Redis safe to use for a distributed lock?
- aledalgrande 7y agoIf implemented correctly, there are guarantees of safety and liveness: https://redis.io/topics/distlock https://redis.io/topics/distlock
- evil-olive 7y agoThe Redlock algorithm suggested for use with Redis has been the subject of some of criticism: https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html https://martin.kleppmann.com/2016/02/08/how-to-do-distribute... Kleppman is the author of Designing Data-Intensive Applications and generally someone whose opinion I trust in such things. I love Redis and use it extensively at $dayjob, but I stick to Consul for managing distributed locks. Consul was built from the ground up to handle such things; Redis handles it as a bit more of an afterthought / consequence of other features.
- aledalgrande 7y agoTrue, not a native feature of Redis. I'll put Consul on my list of things to check, thanks for contributing to my knowledge. Regarding the article, I realized I used the lock for efficiency and not correctness, and it might be why I never encountered issues.
- takeda 7y agoNo, it relies on time. You should use Zookeeper, etcd or Consul
- jasonwatkinspdx 7y agoAntirez claims it is. Others are far more critical of his claims. Personally I'd strongly suggest using a proper consensus implementation such as etcd, consul, zk.