Are you interested in distributed systems? Grab your 🍿 because you might enjoy diving into an interesting discussion about distributed locks and the Redlock pattern used in Redis. These conversations took place a few years ago but they are still relevant in my opinion.

I first discovered an article by Martin Kleppmann: “How to do distributed locking”. It offers a deep dive into the complexities and challenges of implementing distributed locks, and focuses on Redis Redlock pattern. Kleppmann’s perspectives are thought-provoking and provide a solid understanding of the topic.

Following that, I found the rebuttal from Salvatore Sanfilippo, the creator of Redlock, which is also worth reading (actually a must). In the response, Salvatore addresses the concerns raised by Kleppmann and defends the design decisions behind Redlock.

Interestingly, these discussions have even made their way into the official Redis documentation.

One last note: if you’re not deeply familiar with Redis internals, you should be aware that Redis, as of today, still does not use a monotonic clock for its TTL expiration mechanism, which is an important consideration when thinking about distributed locking. You can read more about it in the following disclaimer.

Happy readings! 🙌