Tagged articles
Lua Script
27 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

This tutorial demonstrates implementing login attempt limiting using Spring Boot, Redis, and Lua scripts to block IP addresses after three failed password attempts, with automatic lockout expiration.
AOPBackend DevelopmentJava
0 likes · 20 min read


liandkOct 15, 2026 · Backend Development
This postmortem reveals how AI-generated Redis caching and rate limiting code for a real estate query API passed unit tests but collapsed under 200 concurrent requests, exposing critical flaws in Bloom filter synchronization, mutex lock recursion, random expiration logic, and non-atomic rate limiting — with fixes using Redisson, Lua scripts, and async hot-key refresh.
AI-generated codeLua ScriptRedis caching
0 likes · 11 min read

This article walks through designing a production-grade Redis-backed distributed session system, covering why single-node sessions fail under load balancing, secure token generation with SecureRandom, dual-index Redis storage using Hash and Set with Lua atomic writes, sliding vs absolute expiration, multi-device login limits, and complete login/logout/kick-out implementation with Redisson.
Lua ScriptMulti-Device LoginRedisson
0 likes · 31 min read


JavaGuideSep 14, 2026 · Artificial Intelligence
The article reviews OpenAI's new guide for GPT-6 Astra, showing how to narrow Skill trigger conditions, use progressive disclosure in SKILL.md, make AGENTS.md document reads task-specific, and clarify completion criteria; the author demonstrates a practical audit of their interview-guide project where Codex caught a rate-limiting documentation mismatch.
AGENTS.mdAI agent configurationCodex
0 likes · 10 min read

This article details building real-time leaderboards using Redis ZSet with Spring Boot, covering score encoding for tie-breaking, multi-dimensional key design, pipeline and Lua optimizations, local caching, and data consistency strategies with benchmark results.
Caffeine CacheData ConsistencyLua Script
0 likes · 28 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

The article demonstrates how STAROps' full-stack correlation combined with Yaochi Agent's deep database diagnosis enables cross-layer root cause analysis across three real incidents: an RDS missing index, a Redis Lua script blocking the single thread, and an EVAL command causing CPU saturation, showing command-level diagnostic precision.
EVAL commandLua ScriptObservability
0 likes · 14 min read

This article details a production-grade five-layer traffic protection architecture for microservices, covering hierarchical rate limiting algorithms, IP and user-level sliding window implementations with Redis Lua scripts, dynamic blacklist mechanisms, interface classification (P0/P1/P2), and a real incident review where crawlers bypassed global limits and were defeated by fine-grained controls.
Lua ScriptProduction ArchitectureRisk Control
0 likes · 15 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 how to implement duplicate submission prevention in Spring Boot using a token mechanism with Redis, AOP, and custom annotations, covering idempotency concepts, solution comparisons, code implementation with Lua scripts for atomic operations, and common pitfalls.
AOPIdempotencyLua Script
0 likes · 13 min read

The article explains how Redisson implements a re‑entrant distributed lock using Redis hash structures and the atomic HINCRBY command to manage client identity, re‑entry counting, concurrency safety, and graceful release, providing a complete technical analysis with code, Lua scripts, and best‑practice guidelines.
ConcurrencyDistributed LockHINCRBY
0 likes · 34 min read

This article explains why simple GET‑modify‑SET inventory updates cause overselling in flash‑sale spikes and presents several Redis‑based solutions—including Lua scripts, WATCH‑based optimistic locks, distributed SETNX locks, and asynchronous queue processing—detailing their implementation, advantages, and trade‑offs.
BackendConcurrencyDistributed Lock
0 likes · 8 min read

This article explores why batch execution in Redis improves command efficiency, simplifies client logic, and enhances transaction performance, and then details four core batch query methods—MGET, HMGET, Pipeline, and Lua scripting—along with practical SpringBoot examples and best‑practice considerations.
Lua ScriptMGETPipeline
0 likes · 10 min read

This article explores industry‑proven techniques for handling massive flash‑sale traffic, covering pressure‑distribution, Redis + MQ combos, Lua‑based stock deduction, RocketMQ transactional messages, and Alibaba Cloud's Inventory Hint to ensure consistency and performance under extreme concurrency.
Inventory HintLua ScriptMessage Queue
0 likes · 14 min read

This article examines common industry approaches for handling massive flash‑sale traffic, detailing pressure‑distribution sharding, Redis + MQ integration, the Inventory Hint optimization, and provides concrete Lua script examples and transactional‑message workflows for reliable stock deduction.
Inventory HintLua ScriptMessage Queue
0 likes · 12 min read

This article explains how distributed locks solve data‑consistency problems in clustered environments, introduces Redisson as a Redis‑based locking library, provides Maven and YAML configuration, shows Java code for Redisson setup and test cases, and analyses the underlying Lua scripts and source‑code mechanisms.
ConcurrencyDistributed LockJava
0 likes · 18 min read

This article examines the shortcomings of local locking in microservices, introduces distributed locking concepts, and walks through five progressive Redis-based lock implementations—from a simple SETNX bronze approach to a Lua‑scripted diamond solution—detailing their mechanisms, code examples, and trade‑offs.
Distributed LockJavaLua Script
0 likes · 16 min read

This article explains how Redisson provides Redis‑based distributed locks, covering atomic lock acquisition via Lua scripts, lease time handling, watchdog auto‑extension, re‑entrant and fair locks, read‑write locks, multi‑lock batching, and the RedLock algorithm for high‑availability scenarios.
Fair LockLua ScriptRedisson
0 likes · 24 min read

This article compares three stock‑deduction strategies—single‑field MySQL, sharded MySQL rows, and Redis incrby with Lua scripts—analyzes their concurrency issues, and provides a complete Spring Boot implementation using a distributed lock, Lua script, and callback for initializing stock.
Lua ScriptMySQLredis
0 likes · 9 min read

Implementing a distributed delayed message queue in Go with Redis uses a List for ready jobs and a Sorted Set for delayed jobs, periodically migrating expired entries atomically via Lua or transactions, providing O(1) enqueue/dequeue performance, retry support, and scalable concurrency for multi‑instance systems.
Delayed MessagingGoLua Script
0 likes · 12 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


ITPUBJun 11, 2021 · Backend Development
This comprehensive guide explains why distributed locks are needed, walks through basic Redis lock implementations, reveals common dead‑lock and expiration issues, presents atomic solutions with SET EX NX and Lua scripts, evaluates the Redlock algorithm, examines expert debates, compares Zookeeper locks, and offers practical recommendations for safe usage.
Distributed LockLua ScriptZooKeeper
0 likes · 35 min read

This article explains the concept of distributed locks, compares system classifications based on safety, and provides detailed implementation guides for Redis‑based locks using SET NX EX, as well as exclusive and shared locks using etcd/Zookeeper with proper handling of TTL, leases, and atomic operations.
Distributed LockLua ScriptPaxos
0 likes · 8 min read

This article explains why simple SETNX/EXPIRE commands can cause deadlocks, shows how to achieve atomic lock operations with Lua scripts or the Redis SET command, and demonstrates how to use the Redisson library for re‑entrant, auto‑renewing distributed locks in Java.
Distributed LockLua ScriptRedisson
0 likes · 8 min read

This article explains how to build a high‑traffic flash‑sale (秒杀) system by leveraging browser and CDN caching, read‑write split Redis for traffic interception, master‑slave Redis for atomic inventory deduction with Lua scripts, and Redis‑based message queues for asynchronous order processing.
CachingLua Scriptredis
0 likes · 8 min read


21CTONov 8, 2017 · Backend Development
This article explains how to build reliable distributed locks with Redis, covering essential commands, common pitfalls, improvements using GETSET, Lua scripting for atomicity, and complete Java code examples that address deadlock and unlock vulnerabilities.
Distributed LockJavaLua Script
0 likes · 15 min read
