Tagged articles
Redlock
56 articles · Page 1 of 1
This article analyzes distributed locking in Spring Boot using Redis and Redisson, covering atomic locking with SET NX EX, watchdog lease renewal, reentrant Hash-based design, pub/sub wait notification, the RedLock algorithm debate including Martin Kleppmann's GC pause and clock jump critiques, and production pitfalls with annotation-based AOP encapsulation.
Distributed LockIdempotencyLua Script
0 likes · 23 min read

The article explains how Redis distributed locks with TTL leases fail to prevent stale writes when a garbage collection pause delays a lock holder past its lease expiry, allowing a new holder to write fresh data that the original holder then overwrites upon resuming; it demonstrates why fencing tokens — incrementing sequence numbers issued atomically with lock grants and checked atomically at the storage layer via conditional updates — are necessary to reject obsolete writes.
GC pausePostgreSQLRedlock
0 likes · 12 min read

This article details seven common pitfalls in Redis distributed locking, covering atomic acquisition, ownership verification, lease expiration, watchdog limitations, replication risks, Redlock assumptions, and the need for fencing tokens, with code examples and comparisons to ZooKeeper and etcd.
Distributed LocksMartin KleppmannRedisson
0 likes · 32 min read

This article explains four approaches to implementing distributed locks with Redis: basic SETNX with expiration, atomic Lua scripts for lock acquire/release, the Redisson Java client with watchdog renewal, and the Redlock algorithm for high-availability multi-master deployments.
Distributed LockJavaLua Script
0 likes · 10 min read

This article provides a comprehensive guide to distributed locks in microservices, covering why local locks fail, four fatal flaws of basic implementations, advanced manual locks with Lua scripts, watchdog auto-renewal, Redisson production usage, Redlock for high availability, and a real-world seckill overselling case study.
Distributed LocksLua ScriptRedisson
0 likes · 10 min read

This article explains the three fundamental challenges of distributed locks—availability, deadlock, and split‑brain—compares database and Redis implementations, walks through the five evolutionary steps of Redis locking, and provides a structured interview answer framework to demonstrate deep understanding.
ConcurrencyDistributed LockMySQL
0 likes · 8 min read

The article explains why local locks fail in multi‑machine deployments, defines the three essential properties of a correct distributed lock, walks through seven Redis‑based lock solutions with code samples, highlights common production pitfalls, and provides a decision tree for selecting the right approach.
Distributed LockJava ConcurrencyRedisson
0 likes · 10 min read

This article walks through the evolution of Redis distributed locks—from basic SETNX mutual exclusion to atomic SET with expiration, Lua‑based safe unlocking, Redisson's WatchDog auto‑renewal, and the RedLock algorithm—highlighting pitfalls, best‑practice implementations, and interview‑style Q&A for robust production use.
Distributed LockJavaRedisson
0 likes · 15 min read

This guide explains how Redis implements distributed locks, outlines common pitfalls such as lock contention, zombie locks, and mismatched expiration times, and provides step‑by‑step solutions—including single‑node SET commands, Redlock high‑availability algorithm, Lua‑based safe release, and best‑practice recommendations for real‑world deployments.
Distributed LockRedlockhigh-availability
0 likes · 15 min read

This article explores the fundamentals and advanced techniques of implementing reliable, high‑performance distributed locks with Redis, covering lock acquisition, waiting and retry strategies, expiration, renewal, safe release, the Redlock algorithm, and practical performance optimizations for backend systems.
Redlockbackend development
0 likes · 22 min read

This article explains how to implement distributed locks using Redis, covering basic SETNX/EXPIRE techniques, common pitfalls, atomic Lua scripts, the RedLock algorithm, and practical Redisson usage, while providing Java code examples and best‑practice recommendations.
ConcurrencyDistributed LockLua
0 likes · 22 min read

This article explains how to use Redis for distributed locking, discusses the shortcomings of naive implementations, and presents robust solutions including identifier verification, Lua scripting for atomicity, the RedLock algorithm, and Redisson's advanced features such as re‑entrancy and watchdog mechanisms.
ConcurrencyDistributed LockJava
0 likes · 15 min read

This article explains how to implement a Redis distributed lock, covering the basic SETNX approach, adding expiration, handling lock release errors with renewal and unique identifiers, achieving atomicity via Lua scripts, and discussing the inherent challenges of network delay, process pause, and clock drift in distributed systems.
LuaRedlockbackend development
0 likes · 6 min read

This article explains how to implement distributed locks using Redis, starting with a simple SETNX approach, identifying its shortcomings, and then presenting solutions such as thread‑identifiers, Lua scripts for atomicity, handling TTL with watchdogs, the RedLock algorithm, and practical usage via the Redisson Java client.
Distributed LockJavaLua
0 likes · 18 min read

This article explains how to implement distributed locks using Redis, starting with a basic SETNX approach, identifying its shortcomings, and then presenting robust solutions such as identifier‑based unlocking, Lua scripts for atomicity, the RedLock algorithm, and Redisson’s advanced features including a watchdog mechanism.
BackendConcurrencyDistributed Lock
0 likes · 19 min read

This article explains why distributed locks are needed, outlines Redisson's lock properties, walks through its Lua‑based acquisition, renewal, and release processes, examines master‑slave pitfalls, compares RedLock with Zookeeper, and provides practical code examples for Java developers.
ConcurrencyDistributed LockJava
0 likes · 14 min read

Redis distributed locks require unique identifiers, atomic Lua releases, and TTL refreshes to avoid deadlocks, while the Redlock algorithm adds majority quorum but remains vulnerable to clock drift and client pauses, so critical systems should combine it with fencing tokens or version checks for true safety.
ConcurrencyDistributed LockRedlock
0 likes · 36 min read


LouZaiDec 1, 2023 · Backend Development
This article explains what distributed locks are, outlines their key properties, classifies implementation approaches, and provides detailed walkthroughs of MySQL, Redis, Etcd, and ZooKeeper based locks—including code examples, trade‑offs, and best‑practice recommendations.
Distributed LockGoMySQL
0 likes · 21 min read

This article explains why traditional local locks fail in distributed systems, surveys common distributed‑lock approaches, and provides a step‑by‑step guide to building a robust Redis‑based lock in Java—including expiration handling, UUID safety, Lua‑script atomicity, re‑entrancy, automatic renewal, and the RedLock algorithm—while comparing its performance against plain local locks.
Distributed LockJavaLua
0 likes · 17 min read

This article dissects ten common traps when implementing Redis distributed locks—such as non‑atomic setnx/expire, missing expirations, lock release ordering, non‑re‑entrancy, master‑slave replication issues, and the Redlock algorithm—while providing concrete code examples and practical remedies.
Distributed LockJavaRedisson
0 likes · 14 min read

This article explains the concept of distributed locks, compares them with local JVM locks, outlines essential properties, demonstrates simple Redis-based lock implementations using SETNX and Lua scripts, discusses lock expiration and renewal, and introduces Redisson's advanced features such as automatic watchdog renewal and the Redlock algorithm.
Distributed LockJavaRedisson
0 likes · 13 min read

This article explains the concept of distributed locks, illustrates real‑world scenarios such as concurrent ATM transactions, and details how to implement reliable distributed locking with Redis using TTL keys, SETNX, Lua scripts, lock renewal, high‑availability considerations, and the RedLock algorithm.
BackendConcurrencyDistributed Lock
0 likes · 8 min read

This comprehensive guide explains why distributed locks are needed, outlines their three essential properties, compares common implementations such as Redis, MySQL, ZooKeeper, and Redlock, discusses pitfalls like non‑atomic operations and lock expiration, and presents correct patterns using atomic commands, Lua scripts, watchdogs, and fencing tokens.
Distributed LockLuaMySQL
0 likes · 37 min read

This comprehensive guide walks through the fundamentals, pitfalls, and advanced implementations of Redis distributed locks—including basic SETNX usage, safe lock release with Lua scripts, re‑entrant lock design, timeout handling, Redlock debates, and practical Redisson integration—providing Java developers with actionable patterns for reliable concurrency control.
ConcurrencyDistributed LockJava
0 likes · 25 min read

This article thoroughly examines the safety of Redis-based distributed locks, from basic SETNX implementations to advanced Redlock algorithms, compares them with Zookeeper locks, discusses common pitfalls like deadlocks, clock drift, and network delays, and presents expert debates and practical solutions for robust lock management.
ConcurrencyRedlockredis
0 likes · 32 min read

This article explains why distributed locks are needed in high‑concurrency scenarios, defines their essential properties, and systematically presents seven Redis‑based locking solutions—including SETNX+EXPIRE, timestamp values, Lua scripts, extended SET options, unique‑value verification, Redisson’s watchdog, and the Redlock algorithm—detailing their code examples, advantages, and drawbacks.
Distributed LockLuaRedisson
0 likes · 12 min read

This article thoroughly examines how Redis distributed locks work, the pitfalls of simple SETNX‑based locks such as deadlocks and premature expiration, presents robust solutions using expiration, unique identifiers, Lua scripts, discusses the Redlock algorithm and its controversy, compares Zookeeper locks, and offers practical guidance for safe lock usage.
ConcurrencyDistributed LockLua
0 likes · 31 min read

This comprehensive guide explains the principles, pitfalls, and best practices of implementing Redis distributed locks, covering basic SETNX usage, lock timeout handling, re‑entrant locks, Redlock algorithm debates, and practical Redisson integration with Spring Boot.
JavaRedissonRedlock
0 likes · 24 min read

This article explains how Redis setnx, the Redisson client, and the RedLock algorithm work together to implement distributed locks, discusses common pitfalls such as non‑atomic unlocks, and provides Lua scripts and Java pseudocode for safe lock acquisition and release.
LuaRedissonRedlock
0 likes · 10 min read

This article thoroughly examines how Redis distributed locks work, the safety challenges they face—including deadlocks, lock expiration, and node failures—explores the Redlock algorithm and its controversies, compares Redis with Zookeeper implementations, and offers practical guidelines and best‑practice solutions for reliable distributed locking.
ConcurrencyDistributed LockRedlock
0 likes · 32 min read

This article explains the fundamentals of Redis locking mechanisms, covering SETNX usage, the pitfalls of naive implementations, Lua‑based atomic unlock scripts, the Redisson client library, and the RedLock algorithm, while providing practical code examples and diagrams to illustrate each concept.
Distributed LockLuaRedisson
0 likes · 10 min read

This article explains how Redis implements distributed locks using the SET command with NX and PX options, compares plain setnx, Lua‑based atomic unlock scripts, and Redisson’s high‑level APIs including the RedLock algorithm, and provides practical code examples and pitfalls to avoid.
BackendDistributed LockLua
0 likes · 11 min read

This article explains how Redis locking works, covering the setnx command, the importance of using unique values, atomic unlock via Lua scripts, the Redisson client features, and the RedLock distributed algorithm, while highlighting common pitfalls and practical recommendations.
Distributed LockLua ScriptRedisson
0 likes · 10 min read

This article explores the most common Redis locking mechanisms—SetNX, RedLock, and Redisson—detailing their principles, pitfalls, and implementation nuances, including code examples, Lua scripts for atomic unlocks, and best‑practice recommendations for building reliable distributed locks in backend systems.
Distributed LockRedissonRedlock
0 likes · 11 min read

This article explains how Redis locking works by detailing the setnx command, its modern usage with the SET command and PX expiration, common pitfalls, safe unlocking with unique values and Lua scripts, and introduces Redisson's lock implementations and the RedLock algorithm for distributed environments.
RedissonRedlockbackend development
0 likes · 10 min read

This article explains what distributed locks are, outlines their essential properties, walks through step‑by‑step Redis implementations—from simple SETNX to Lua‑based atomic operations—and discusses reliability strategies such as master‑slave failover and RedLock while highlighting the inherent limits of any distributed lock.
Distributed LockLua scriptingRedlock
0 likes · 11 min read

This article thoroughly explains why distributed locks are needed, walks through basic Redis lock implementations, exposes deadlock and expiration issues, presents robust solutions with unique IDs and Lua scripts, examines the Redlock algorithm, reviews the Martin‑Antirez debate, and compares Redis with Zookeeper locks.
LuaRedlockZooKeeper
0 likes · 40 min read


ITPUBJun 29, 2021 · Backend Development
This article thoroughly examines the safety of Redis‑based distributed locks, explains basic SETNX locking, explores deadlock and lock‑release problems, presents robust solutions such as atomic SET with expiration, Lua scripts, and unique tokens, and critically compares Redlock with Zookeeper while summarizing expert debates and best‑practice recommendations.
LuaRedlockfault tolerance
0 likes · 34 min read

This article explains the concept of distributed locks, compares various implementation approaches such as Memcached, Zookeeper, Chubby, and Redis, and details single‑node and multi‑node Redis lock designs—including SETNX, SET with NX/EX options, Redisson, and the Redlock algorithm—while highlighting their advantages, pitfalls, and best‑practice recommendations.
ConcurrencyDistributed LockRedlock
0 likes · 14 min read

This article explains the fundamentals and pitfalls of using Redis for distributed locking, covering the setnx command, the SET command with NX and PX options, Lua‑based lock scripts, Redisson’s lock implementations, and the RedLock algorithm, along with practical code examples.
Distributed LockLuaRedisson
0 likes · 12 min read

This article explains the fundamentals of Redis locking mechanisms, including the setnx command, the RedLock algorithm, and how the Redisson Java client implements distributed locks with Lua scripts, highlighting pitfalls, best practices, and code examples for safe lock acquisition and release.
JavaLuaRedisson
0 likes · 10 min read

This article explains how Redis can be used for distributed locking, covering the setnx command, the SET command with NX and PX options, common pitfalls, Lua‑based atomic unlock scripts, the Redisson client, and the RedLock algorithm for achieving reliable locks across multiple nodes.
Distributed LockLua scriptingRedisson
0 likes · 10 min read

This article explores Redis locking mechanisms, explaining the SETNX command, its limitations, the use of PX for timeouts, Lua scripts for atomic unlocks, and introduces Redisson’s advanced lock implementations including RedLock, while highlighting practical pitfalls and best‑practice recommendations for reliable distributed synchronization.
LuaRedissonRedlock
0 likes · 11 min read

This article examines common failure scenarios of Redis‑based distributed locks, compares a simple lock implementation with the Redlock algorithm, and provides practical solutions for single‑point failures, lock expiration issues, clock drift, and high‑concurrency pitfalls.
ConcurrencyDistributed LockJava
0 likes · 18 min read

This article examines common failures of Redis‑based distributed locks, explains the limitations of simple implementations, introduces the Redlock algorithm, and provides practical solutions for high‑concurrency, node failures, TTL overruns, and system clock drift.
Redlockredis
0 likes · 17 min read

This article explains the three common distributed‑lock implementations, details the requirements for a Redis‑based lock, provides Java code for acquiring and releasing the lock with Lua scripts, discusses the Redlock algorithm, and shows how to use Redisson’s reentrant and RedLock implementations in production.
BackendJavaRedlock
0 likes · 8 min read

This article explains how to implement ordinary Redis distributed locks and the advanced Redlock algorithm using Redisson across single‑node, sentinel, and cluster architectures, provides complete Java code examples, and addresses common questions about expiration, high availability, and comparisons with Zookeeper.
Distributed LockJavaRedisson
0 likes · 11 min read

This article reviews the evolution of Redis‑based distributed lock implementations—from the simple V1.0 pattern to the more robust V3.1 and Redlock algorithm—highlighting their mechanisms, common pitfalls, and guidance on selecting the most suitable lock for a given scenario.
BackendConcurrencyDistributed Lock
0 likes · 13 min read

This article explains the classic Redis distributed lock using SETNX and Lua, highlights its pitfalls, introduces the advanced Redlock algorithm with step‑by‑step acquisition and release procedures, and provides concrete Java Redisson code examples, illustrating how to implement reliable distributed locks across multiple Redis nodes.
Distributed LockJavaRedisson
0 likes · 12 min read

Learn how to implement Redis distributed locks in both single‑node and cluster environments, covering lock acquisition and release commands, key pitfalls like master‑slave failover, and the advanced Redlock algorithm with step‑by‑step guidance, Lua scripts, and a PHP lock class example.
Distributed LockLuaPHP
0 likes · 9 min read

This article analyzes the principles, advantages, and drawbacks of distributed locking with Redis and Zookeeper, comparing single‑node and cluster scenarios, discussing RedLock, EPHEMERAL znodes, and practical failure cases to help engineers choose the right solution.
ConsistencyDistributed LockRedlock
0 likes · 16 min read

This article examines the evolution of distributed locking—from simple MySQL table locks to Redis cache locks and the Redlock algorithm—highlighting their limitations, expert criticisms, and why Zookeeper often provides a more reliable solution for high‑availability systems.
RedlockZooKeepercache lock
0 likes · 21 min read

This article revisits the Redlock debate by examining Antirez's rebuttal to Martin Kleppmann, analyzing Hacker News discussions, comparing Redis, ZooKeeper, and Chubby lock implementations, and exploring timing assumptions, clock skew, and fencing token mechanisms to assess distributed lock safety.
ChubbyDistributed LocksRedlock
0 likes · 32 min read

An in‑depth review of the heated debate between Redis creator antirez and distributed‑systems expert Martin Kleppmann over the safety of Redis’s Redlock algorithm, covering single‑node lock pitfalls, failover issues, timing assumptions, fencing tokens, and practical recommendations for when to use Redlock versus simpler locks.
ConsistencyDistributed LockFailover
0 likes · 25 min read

This article reviews the evolution of distributed locking—from simple MySQL table locks to Redis cache locks and the Redlock algorithm—examines expert criticisms of Redlock’s correctness, presents the Redis author’s rebuttal, and ultimately recommends Zookeeper as a more reliable solution for high‑availability distributed locks.
CacheConsensusDistributed Lock
0 likes · 22 min read

This article explains how to build reliable distributed locks using Redis, introduces the official RedLock algorithm, discusses safety properties, compares it with simple failover approaches, and provides implementation details, performance considerations, and lock‑extension techniques.
ConcurrencyDistributed LockRedlock
0 likes · 16 min read
