Tagged articles
distributed-lock
28 articles · Page 1 of 1
To prevent duplicate operations caused by network glitches, user errors, or retries, this article explains four common idempotency strategies—token, database unique index, distributed lock, and request payload hashing—providing clear concepts, key considerations, and ready‑to‑copy Java/Spring code examples.
Idempotencydatabase-indexdistributed-lock
0 likes · 9 min read

This article explains the fundamentals of distributed locks, compares Redis, etcd, ZooKeeper and database approaches, provides practical Go code examples, highlights common mistakes, and offers optimization tips so developers can confidently apply the right locking strategy in real-world systems.
BackendZooKeeperdistributed-lock
0 likes · 12 min read

This article examines common pitfalls of using single‑machine synchronization and basic SETNX locks for high‑concurrency stock‑deduction scenarios, demonstrates step‑by‑step improvements—including lock expiration and Redisson’s Lua‑based implementation—and discusses trade‑offs between Redis and Zookeeper for distributed locking.
RedisRedissondistributed-lock
0 likes · 16 min read

This article shares ten practical cache governance rules—from avoiding large keys and setting proper TTLs to using distributed locks and final consistency strategies—illustrated with real‑world Java examples, code snippets, and diagrams to help backend developers design reliable, high‑performance caching solutions.
BackendCachingRedis
0 likes · 12 min read

This article explains why inventory overselling occurs during massive sales events, analyzes the root causes such as non‑atomic database operations, and presents practical solutions—including optimistic locking, Redis atomic scripts, distributed locks, message‑queue peak shaving, and pre‑deduct strategies—while highlighting common pitfalls and best‑practice combinations for robust e‑commerce back‑ends.
Redisdistributed-lockecommerce
0 likes · 9 min read

This article explains how to prevent duplicate submissions in Java backend APIs by applying debounce techniques using shared Redis caches or Redisson distributed locks, detailing the design of a @RequestLock annotation, key generation, aspect implementation, and practical testing results.
Redissondebouncedistributed-lock
0 likes · 15 min read

This article explains how SpringBoot's default @EnableScheduling and @Scheduled annotations can cause execution delays and single‑threaded bottlenecks, demonstrates the root causes in the auto‑configured ThreadPoolTaskScheduler, and provides four practical solutions—including custom thread‑pool configuration, async execution, and Redisson‑based distributed locking—to achieve reliable, concurrent scheduled tasks in both monolithic and distributed environments.
Schedulingasyncdistributed-lock
0 likes · 15 min read

This article shares a detailed account of a Tencent testing engineer interview, covering self‑introduction, Go knowledge, Redis performance, distributed lock implementation, semaphore mechanics, RPC vs HTTP, concurrency usage, Git security practices, Linux commands, and a few brain‑teaser and algorithm questions.
BackendGoInterview
0 likes · 13 min read

This article explains why Redis experiences key‑setting race conditions under high concurrency and presents two practical solutions—using a distributed lock with timestamps and serializing writes via a message queue—to ensure correct ordering and data consistency.
Concurrencydistributed-lockmessage-queue
0 likes · 5 min read

This article compares popular Java task scheduling solutions—including Quartz, Spring Schedule with Redis locks, ElasticJob‑Lite, centralized MQ and XXL‑JOB approaches—explaining their core components, clustering strategies, code examples, and practical selection guidance for building reliable distributed schedulers.
ElasticJobQuartzXXL-JOB
0 likes · 19 min read

The article analyzes the challenges of keeping cache and database consistent after write operations, evaluates four update‑order strategies, discusses their concurrency pitfalls, and presents practical solutions such as CAS, distributed locks, asynchronous updates, and delayed double‑delete techniques.
BackendCASCache
0 likes · 8 min read

The article analyzes why a coupon‑distribution feature can over‑issue coupons under high concurrency, demonstrates the root cause with race conditions, and presents four practical solutions—including Java synchronized blocks, SQL row‑level checks, optimistic locking, and Redis‑based distributed locks using Redisson—to ensure safe coupon redemption.
coupondistributed-lock
0 likes · 12 min read

This tutorial demonstrates how to protect Spring Boot services from malicious requests by creating a custom interceptor that tracks request counts per IP and URL, uses Redis for distributed locking, and disables abusive IPs after a configurable threshold within a defined time window.
Interceptordistributed-lockrate-limiting
0 likes · 9 min read

The article discusses how to achieve reasonable read/write consistency between databases and caches by emphasizing cache expiration, eventual consistency, analyzing the Cache‑Aside pattern, evaluating four update‑order options, recommending the "update‑DB‑then‑delete‑cache" approach, and suggesting async deletion via message queues and distributed locks to handle concurrency and cache breakdown.
Cache AsideConsistencydistributed-lock
0 likes · 19 min read

This article explains the concept of distributed locks, compares three implementation methods—database unique indexes, Redis (using SETNX), and Zookeeper—provides detailed SQL table design and Java code examples for acquiring and releasing locks, and discusses reentrancy, lock release timing, and single‑point failure considerations.
JavaRedisZooKeeper
0 likes · 14 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.
LuaRedLockRedisson
0 likes · 10 min read

This article examines the most frequent problems encountered with Redis distributed locks—including non‑atomic operations, forgotten releases, accidental unlocking of others, massive request failures, re‑entrancy, lock contention, timeout handling, and master‑slave replication—while offering practical code examples and mitigation strategies.
Luadistributed-lock
0 likes · 22 min read

This article examines the typical mistakes when using Redis distributed locks—such as non‑atomic operations, forgetting to release locks, releasing others' locks, lock starvation, re‑entrancy issues, lock granularity, timeout handling, and master‑slave replication problems—and provides practical solutions and code examples for each scenario.
Redissondistributed-lockpitfalls
0 likes · 21 min read

This article explores how to leverage Redis for a wide range of backend functionalities—including caching, distributed data sharing, locks, global IDs, counters, rate limiting, bitmap statistics, shopping carts, timelines, message queues, lotteries, likes, product tagging, filtering, follow relationships, and leaderboards—providing practical code examples and usage patterns.
BitmapCachingCounter
0 likes · 8 min read

This article provides a comprehensive overview of Redis interview questions, covering persistence mechanisms, cache avalanche and penetration, hot vs. cold data, differences from Memcached, single‑threaded performance, data structures, internal architecture, expiration policies, clustering options, distributed locks, and transaction handling.
CachingClusterdata-structures
0 likes · 24 min read

To prevent duplicate OpenID records caused by concurrent synchronization requests in the Fast App Center, this article analyzes the root cause, evaluates database‑level unique indexes versus application‑level distributed locks, and presents a Redis‑based lock implementation with cleanup procedures to ensure data consistency.
BackendData ConsistencyJava
0 likes · 16 min read

This article walks through nine practical Redis use cases—including basic KV caching, distributed locking, delayed queues, rate limiting, service discovery, bitmap storage, HyperLogLog counting, roaring bitmaps, and Bloom filters—explaining the underlying concepts, configuration tips, and code examples for robust backend development.
BitmapBloom FilterCaching
0 likes · 20 min read

This article explains the different lock types—pessimistic, optimistic, and distributed—illustrates their use cases with code examples, compares four practical solutions for high‑concurrency deduction scenarios, and offers guidance on selecting the right locking strategy.
ConcurrencyJavadistributed-lock
0 likes · 10 min read

This article explains the fundamentals of backend architecture, covering Maven's settings.xml, front‑back separation, various types of locks (thread, process, distributed), detailed Redis‑based and Zookeeper‑based distributed lock implementations with code examples, session handling in distributed systems, and key Spring‑Redis caching annotations.
BackendJavaRedis
0 likes · 15 min read

This article analyzes a severe overselling incident caused by an unsafe Redis distributed lock during a high‑traffic flash‑sale, explains the root causes, and presents safer lock and atomic stock‑decrement solutions with improved Java code examples.
ConcurrencySpringdistributed-lock
0 likes · 11 min read

This article explains why a MySQL repeatable‑read transaction can produce an incorrect negative balance, then shows how to prevent such anomalies by implementing a reliable, re‑entrant distributed lock using Redis commands, Lua scripts, and Java/Spring‑Boot code, while also covering lock expiration, atomicity, and the RedLock algorithm.
distributed-lockspring-boot
0 likes · 16 min read

This article explains the concept of idempotency in programming, outlines common causes of duplicate submissions, and presents multiple solutions—including frontend button disabling, PRG pattern, session tokens, database constraints, local locks using ConcurrentHashMap, AOP interceptors, and distributed Redis locks—complete with Java code examples.
distributed-lockspring-boot
0 likes · 14 min read

This article explains how to build a reliable distributed lock using Redis by introducing essential Redis commands, presenting initial Java pseudocode, addressing race‑condition pitfalls, improving the design with GETSET and Lua scripts, and providing complete, production‑ready Java implementations with unlock safety fixes.
BackendLuadistributed-lock
0 likes · 16 min read
