Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Is Redis safe to use for a distributed lock?


The 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-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.


True, 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.


Antirez 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.


If implemented correctly, there are guarantees of safety and liveness: https://redis.io/topics/distlock


No, it relies on time.

You should use Zookeeper, etcd or Consul




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: