<story><title>How to do distributed locking</title><url>http://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html</url></story><parent_chain></parent_chain><comment><author>antirez</author><text>Thanks to Martin for analyzing Redlock, I looked forward to an analysis. I don&amp;#x27;t agree with the two main arguments of the analysis. TLDR: I think the unique random token of Redlock is enough for Check &amp;amp; Set when the lock holder work materializes into a database write (also note that it requires a linearizable database, to check token_A_ID &amp;gt; token_B_ID in the Martin proposed solution), and I think the system model is very real world (AFAIK the algorithm is not dependent on bounded network delays, I think there is an issue in the analysis, details in my blog post so other people can evaluate), and that the fact different processes can count relative time, without any absolute clock, with a bound error (like, 10%) is absolutely credible. However, I&amp;#x27;m analyzing the analysis in depth right now and writing a blog post with the details to be posted tomorrow. Also note that usually when you need a distributed lock, it&amp;#x27;s because you have no sane way to handle race conditions, otherwise you can do with some weaker and&amp;#x2F;or optimistic locking form to start with.</text></comment>
<story><title>How to do distributed locking</title><url>http://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html</url></story><parent_chain></parent_chain><comment><author>cryptica</author><text>If you want to have a truly parallel system, you cannot share resources between processes. If you need a lock, then that implies sharing of resources... Which implies limited scalability according to Amdahl&amp;#x27;s law.&lt;p&gt;To achieve unlimited scalability, you need to make sure that no single data store is shared between all processes and that the amount of interprocess communication (on a per-process basis) doesn&amp;#x27;t increase as you add more processes.&lt;p&gt;The more sharing you have, the less you can scale your system.</text></comment>