Tagged articles
48 articles
Page 1 of 1
Xuanwu Backend Tech Stack
Xuanwu Backend Tech Stack
Dec 23, 2025 · Backend Development

Mastering Redis Distributed Locks: From SETNX to RedLock and WatchDog

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.

RedlockWatchdogdistributed-lock
0 likes · 15 min read
Mastering Redis Distributed Locks: From SETNX to RedLock and WatchDog
NiuNiu MaTe
NiuNiu MaTe
Dec 17, 2025 · Backend Development

Master Redis Distributed Locks: Prevent Race Conditions, Zombie Locks, and Expiration Issues

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.

Redlockdistributed-lockhigh-availability
0 likes · 15 min read
Master Redis Distributed Locks: Prevent Race Conditions, Zombie Locks, and Expiration Issues
Java Architect Essentials
Java Architect Essentials
Aug 4, 2024 · Backend Development

Implementing Distributed Locks with Redis: Concepts, Pitfalls, and Solutions

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.

Redlockconcurrencydistributed-lock
0 likes · 15 min read
Implementing Distributed Locks with Redis: Concepts, Pitfalls, and Solutions
Selected Java Interview Questions
Selected Java Interview Questions
Jul 15, 2024 · Backend Development

Redis Distributed Lock: Basic Implementation, Expiration, Safety Measures, and Lua Atomicity

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
Redis Distributed Lock: Basic Implementation, Expiration, Safety Measures, and Lua Atomicity
IT Architects Alliance
IT Architects Alliance
Jul 10, 2024 · Backend Development

Mastering Distributed Locks with Redis: From Basic SETNX to RedLock and Redisson

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.

LuaRedlockdistributed-lock
0 likes · 18 min read
Mastering Distributed Locks with Redis: From Basic SETNX to RedLock and Redisson
Architect
Architect
Jul 9, 2024 · Backend Development

Mastering Distributed Locks with Redis: From Simple SETNX to RedLock and Redisson

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.

BackendRedlockconcurrency
0 likes · 19 min read
Mastering Distributed Locks with Redis: From Simple SETNX to RedLock and Redisson
Architect
Architect
Feb 18, 2024 · Backend Development

How Redisson Implements Distributed Locks: Deep Dive into Mechanisms and Pitfalls

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.

Lock MechanismRedlockconcurrency
0 likes · 14 min read
How Redisson Implements Distributed Locks: Deep Dive into Mechanisms and Pitfalls
Tencent Cloud Developer
Tencent Cloud Developer
Jan 24, 2024 · Backend Development

Understanding the Safety of Redis Distributed Locks and the Redlock Debate

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.

RedlockZooKeeperconcurrency
0 likes · 36 min read
Understanding the Safety of Redis Distributed Locks and the Redlock Debate
Selected Java Interview Questions
Selected Java Interview Questions
Nov 7, 2023 · Backend Development

Implementing Distributed Locks with Redis: Principles, Challenges, and Optimizations

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.

LuaRedlockReentrancy
0 likes · 17 min read
Implementing Distributed Locks with Redis: Principles, Challenges, and Optimizations
Architect
Architect
Jul 20, 2023 · Backend Development

10 Hidden Pitfalls of Redis Distributed Locks and How to Avoid Them

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.

Redlockbackend-developmentdistributed-lock
0 likes · 14 min read
10 Hidden Pitfalls of Redis Distributed Locks and How to Avoid Them
IT Services Circle
IT Services Circle
Mar 31, 2023 · Backend Development

Understanding Distributed Locks and Implementations with Redis and Redisson

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.

RedlockWatchdogdistributed-lock
0 likes · 13 min read
Understanding Distributed Locks and Implementations with Redis and Redisson
Aikesheng Open Source Community
Aikesheng Open Source Community
Jan 3, 2023 · Backend Development

Understanding Distributed Locks and Redis RedLock Implementation

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.

BackendLuaRedlock
0 likes · 8 min read
Understanding Distributed Locks and Redis RedLock Implementation
dbaplus Community
dbaplus Community
Aug 25, 2022 · Backend Development

Mastering Distributed Locks: From Basics to Redlock and Beyond

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.

LuaRedlockdistributed-lock
0 likes · 37 min read
Mastering Distributed Locks: From Basics to Redlock and Beyond
Bin's Tech Cabin
Bin's Tech Cabin
Jul 1, 2022 · Backend Development

Mastering Redis Distributed Locks: From Basics to Advanced Redlock Strategies

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.

LuaRedlockconcurrency
0 likes · 25 min read
Mastering Redis Distributed Locks: From Basics to Advanced Redlock Strategies
Sanyou's Java Diary
Sanyou's Java Diary
Feb 14, 2022 · Backend Development

Is Redis Redlock Really Safe? Uncovering the Truth Behind Distributed Locks

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.

RedlockSafetyconcurrency
0 likes · 32 min read
Is Redis Redlock Really Safe? Uncovering the Truth Behind Distributed Locks
Code Ape Tech Column
Code Ape Tech Column
Feb 10, 2022 · Databases

Redis Distributed Lock: Seven Correct Implementation Schemes

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.

LuaRedlockdistributed-lock
0 likes · 12 min read
Redis Distributed Lock: Seven Correct Implementation Schemes
Cloud Native Technology Community
Cloud Native Technology Community
Dec 9, 2021 · Backend Development

Redis Distributed Locks: Safety Issues, Redlock Debate, and Best Practices

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.

LuaRedlockZooKeeper
0 likes · 31 min read
Redis Distributed Locks: Safety Issues, Redlock Debate, and Best Practices
macrozheng
macrozheng
Dec 9, 2021 · Backend Development

Mastering Redis Distributed Locks: From Basics to Advanced Redisson Practices

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.

RedlockSpring Bootjava
0 likes · 24 min read
Mastering Redis Distributed Locks: From Basics to Advanced Redisson Practices
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 23, 2021 · Backend Development

Redis Distributed Locks: Safety Issues, Redlock Debate, and Best Practices

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.

Redlockconcurrencydistributed-lock
0 likes · 32 min read
Redis Distributed Locks: Safety Issues, Redlock Debate, and Best Practices
Programmer DD
Programmer DD
Oct 9, 2021 · Databases

Mastering Redis Locks: From SETNX to RedLock and Redisson

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.

LuaRedlockdistributed-lock
0 likes · 10 min read
Mastering Redis Locks: From SETNX to RedLock and Redisson
Architecture Digest
Architecture Digest
Oct 2, 2021 · Databases

Understanding Redis Locks: setnx, RedLock, Redisson and Best Practices

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.

Lua ScriptRedlockdistributed-lock
0 likes · 10 min read
Understanding Redis Locks: setnx, RedLock, Redisson and Best Practices
MaGe Linux Operations
MaGe Linux Operations
Oct 1, 2021 · Backend Development

Mastering Redis Distributed Locks: From SetNX to RedLock and Redisson

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.

Redlockbackend-developmentdistributed-lock
0 likes · 11 min read
Mastering Redis Distributed Locks: From SetNX to RedLock and Redisson
Top Architect
Top Architect
Oct 1, 2021 · Backend Development

Understanding Redis Locks: setnx, Redisson, and RedLock

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.

Redlockbackend-developmentredis
0 likes · 10 min read
Understanding Redis Locks: setnx, Redisson, and RedLock
NiuNiu MaTe
NiuNiu MaTe
Sep 8, 2021 · Backend Development

Mastering Distributed Locks with Redis: From Basics to RedLock

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.

Lua scriptingRedlockdistributed-lock
0 likes · 11 min read
Mastering Distributed Locks with Redis: From Basics to RedLock
dbaplus Community
dbaplus Community
Jul 25, 2021 · Backend Development

Is Redis Distributed Lock Safe? Deep Dive into Redlock and Zookeeper Pitfalls

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
Is Redis Distributed Lock Safe? Deep Dive into Redlock and Zookeeper Pitfalls
ITPUB
ITPUB
Jun 29, 2021 · Backend Development

Is Redis Distributed Lock Really Safe? A Deep Dive into Redlock, Pitfalls, and Alternatives

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
Is Redis Distributed Lock Really Safe? A Deep Dive into Redlock, Pitfalls, and Alternatives
Qunar Tech Salon
Qunar Tech Salon
Jul 14, 2020 · Backend Development

Distributed Lock Mechanisms and Their Redis Implementations

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.

Redlockconcurrencydatabase
0 likes · 14 min read
Distributed Lock Mechanisms and Their Redis Implementations
Top Architect
Top Architect
Jul 13, 2020 · Databases

Understanding Redis Distributed Locks: setnx, Redisson, and RedLock

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.

LuaRedlockdistributed-lock
0 likes · 12 min read
Understanding Redis Distributed Locks: setnx, Redisson, and RedLock
Architecture Digest
Architecture Digest
Jul 4, 2020 · Databases

Understanding Redis Locks: setnx, RedLock, and Redisson

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.

LuaRedlockjava
0 likes · 10 min read
Understanding Redis Locks: setnx, RedLock, and Redisson
Architect's Tech Stack
Architect's Tech Stack
Jun 11, 2020 · Backend Development

Understanding Redis Distributed Locks: setnx, RedLock, and Redisson

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.

Lua scriptingRedlockbackend-development
0 likes · 10 min read
Understanding Redis Distributed Locks: setnx, RedLock, and Redisson
Programmer DD
Programmer DD
Jun 11, 2020 · Backend Development

Mastering Redis Distributed Locks: From SETNX to RedLock and Redisson

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.

LuaRedlockredis
0 likes · 11 min read
Mastering Redis Distributed Locks: From SETNX to RedLock and Redisson
dbaplus Community
dbaplus Community
Apr 27, 2020 · Backend Development

Why Your Redis Distributed Lock May Fail and How to Fix It

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.

Lock PitfallsRedlockconcurrency
0 likes · 18 min read
Why Your Redis Distributed Lock May Fail and How to Fix It
ITFLY8 Architecture Home
ITFLY8 Architecture Home
Mar 10, 2020 · Backend Development

Why Your Redis Distributed Lock May Fail and How to Fix It

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
Why Your Redis Distributed Lock May Fail and How to Fix It
Selected Java Interview Questions
Selected Java Interview Questions
Oct 24, 2019 · Backend Development

Implementing Distributed Locks with Redis: Principles, Code Samples, Redlock Algorithm and Redisson Usage

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.

BackendRedlockjava
0 likes · 8 min read
Implementing Distributed Locks with Redis: Principles, Code Samples, Redlock Algorithm and Redisson Usage
Programmer DD
Programmer DD
Feb 27, 2019 · Backend Development

Mastering Redis Distributed Locks with Redisson: From Simple Locks to Redlock

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.

Redlockdistributed-lockjava
0 likes · 11 min read
Mastering Redis Distributed Locks with Redisson: From Simple Locks to Redlock
Programmer DD
Programmer DD
Feb 20, 2019 · Fundamentals

Mastering Redis Redlock: A Deep Dive into Distributed Lock Implementation

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.

Redlockdistributed-lockjava
0 likes · 12 min read
Mastering Redis Redlock: A Deep Dive into Distributed Lock Implementation
dbaplus Community
dbaplus Community
Mar 16, 2017 · Backend Development

Redlock vs Antirez: A Deep Dive into Distributed Lock Safety and Fencing Tokens

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
Redlock vs Antirez: A Deep Dive into Distributed Lock Safety and Fencing Tokens
dbaplus Community
dbaplus Community
Mar 9, 2017 · Databases

Why Redis Redlock May Not Be Safe: A Deep Dive into the Redlock Debate

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.

ConsistencyRedlockdistributed-lock
0 likes · 25 min read
Why Redis Redlock May Not Be Safe: A Deep Dive into the Redlock Debate
ITFLY8 Architecture Home
ITFLY8 Architecture Home
Nov 24, 2016 · Fundamentals

Why Redlock May Not Be the Ultimate Distributed Lock (And What to Use Instead)

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.

CacheConsensusRedlock
0 likes · 22 min read
Why Redlock May Not Be the Ultimate Distributed Lock (And What to Use Instead)
Architect
Architect
Dec 11, 2015 · Backend Development

Implementing Distributed Locks with Redis: The RedLock Algorithm

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.

Redlockconcurrencydistributed-lock
0 likes · 16 min read
Implementing Distributed Locks with Redis: The RedLock Algorithm