# Analysis of Redlock Safety in Distributed Locking

DevFeed: [Analysis of Redlock Safety in Distributed Locking](<https://devfeed.tech/articles/is-redlock-safe-20592.md>)

Original publisher: [Read original article](<http://antirez.com/news/101>)

Published: 2016-02-09T15:33:51Z

Content type: article

Language: en

Sources: [Antirez](<https://devfeed.tech/sources/antirez.md>)

Topics: [distributed-systems](<https://devfeed.tech/topics/distributed-systems.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [Algorithm](<https://devfeed.tech/topics/algorithm.md>), [systems](<https://devfeed.tech/topics/systems.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [analysis](<https://devfeed.tech/tags/analysis.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [failover](<https://devfeed.tech/tags/failover.md>), [locking](<https://devfeed.tech/tags/locking.md>), [performance](<https://devfeed.tech/tags/performance.md>), [redis](<https://devfeed.tech/tags/redis.md>)

## AI overview

This article examines whether Redlock, a client-side distributed locking algorithm designed for Redis, can provide safe distributed locks with automatic release. It responds to Martin Kleppmann's analysis, which concludes that Redlock is unsafe, and presents a counter-analysis for further expert evaluation.

## Source excerpt

Martin Kleppmann, a distributed systems researcher, yesterday published an analysis of Redlock (http://redis.io/topics/distlock), that you can find here: http://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html Redlock is a client side distributed locking algorithm I designed to be used with Redis, but the algorithm orchestrates, client side, a set of nodes that implement a data store with certain capabilities, in order to create a multi-master fault tolerant, and hopefully safe, distributed lock with auto release capabilities. You can implement Redlock using MySQL instead of Redis, for example. The algorithm's goal was to move away people that were using a single Redis instance, or a master-slave setup with failover, in order to implement distributed locks, to something much more reliable and safe, but having a very low complexity and good performance. Since I published Redlock people implemented it in multiple languages and used it for different purposes. Martin's analysis of the algorithm concludes that Redlock is not safe. It is great that Martin published an analysis, I asked for an analysis in the original Redlock specification here: http://redis.io/topics/distlock. So thank you Martin. However I don't agree with the analysis. The good thing is that distributed systems are, unlike other fields of programming, pretty mathematically exact, or they are not, so a given set of properties can be guaranteed by an algorithm or the algorithm may fail to guarantee them under certain assumptions. In this analysis I'll analyze Martin's analysis so that other experts in the field can check the two documents (the analysis and the counter-analysis), and eventually we can understand if Redlock can be considered safe or not. Why Martin thinks Redlock is unsafe ----------------------------------- The arguments in the analysis are mainly two: 1. Distributed locks with an auto-release feature (the mutually exclusive lock property is only valid for a fixed amount