This article explains how to implement gray (canary) releases using Nginx, Lua, and Redis, covering common gray‑release strategies, detailed configuration examples, Lua scripts for routing by request parameters, IP or cookies, and suggestions for extending the solution with other data sources or scripting languages.
This guide demonstrates how to use Spring Boot 2.7 with Redis 6.2 to implement Pub/Sub messaging, transactional operations, pipelined commands, and Lua‑based distributed locks, providing code examples, configuration details, and explanations of each feature’s advantages and limitations.
The article shows how to build a reliable Redis‑based distributed lock in a Spring Boot 2.7 application by storing a unique UUID token, acquiring the lock with SET NX PX, releasing it atomically via a Lua script, and providing a clean Lock interface, factory component, and JUnit example.
This article explains how to implement multi‑rule rate limiting in a distributed Java application using Redis, covering String‑based counters, Zset timestamp storage, Lua scripts for atomic checks, custom @RateLimiter annotations, key generation logic, and an AOP interceptor that enforces the limits.
This article explains Lua fundamentals, why Lua is advantageous inside Redis, common use‑cases such as cache updates and distributed locks, and provides step‑by‑step guidance for integrating and executing Lua scripts in a Spring Boot application to improve performance and ensure atomicity.
This article explains two API rate‑limiting strategies—fixed‑window using Redis keys and sliding‑window using Redis sorted sets—detailing their principles, drawbacks, and providing complete Java implementations with Lua scripts, AOP annotations, and Redis configuration to enforce request limits.
A Redis lock timeout caused users to be blocked for two hours, revealing problems with lock leakage and mis‑release; the article explains the root causes, proper use of SETNX with EXPIRE, and Lua scripts for atomic operations and safe lock deletion.
This article explains how to design and implement a distributed rate‑limiting solution that supports multiple concurrent rules—such as per‑minute and per‑hour limits—by analyzing the shortcomings of simple string counters, introducing atomic Lua scripts and Zset structures, and providing complete Java annotation and AOP code examples.
This comprehensive guide explains Redis fundamentals, its rich data structures, persistence mechanisms (RDB and AOF), enterprise‑level configuration strategies, common usage patterns such as caching, ranking and geolocation, and dives deep into distributed lock implementations with Redisson and Lua scripts, providing practical code examples for real‑world applications.
This guide explains how to build a dynamic IP blacklist using Nginx, Lua, and Redis, covering installation of LuaJIT, compiling Nginx with required modules, configuring Redis, writing Lua access‑limit scripts, and verifying that frequent requests are automatically blocked for a set period.
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.
This article explains how to integrate Lua scripts into Spring Boot projects for Redis, covering Lua fundamentals, performance benefits, practical use cases, step‑by‑step implementation with code examples, error handling, security considerations, and best‑practice recommendations for backend developers.
This article examines why local locks fail in distributed micro‑service environments, introduces Redis‑based distributed locking, walks through five incremental lock designs—from a simple SETNX implementation to a Lua‑script atomic solution—highlighting each scheme's trade‑offs, code examples, and practical pitfalls.
This article explains how to use Lua scripts for performance testing by providing reusable functions that encapsulate HTTP and HTTPS GET/POST requests, support JSON and FormData payloads, and enable file uploads, complete with full code examples.
This article explains how Redis can be used to implement distributed locks, outlines common pitfalls such as non‑atomic operations, lock expiration, incorrect unlocking, lack of re‑entrancy and waiting mechanisms, and presents Lua scripts, Java examples, and cluster‑level considerations to mitigate these issues.
This article explains the concept of distributed locks for ensuring data consistency in clustered environments, outlines common implementation approaches, and provides a comprehensive guide to using Redisson in Java—including Maven setup, YAML configuration, core source‑code analysis, Lua scripts for lock and unlock operations, and practical test cases.
This article provides an in‑depth tutorial on designing and implementing various rate‑limiting strategies—such as token bucket, leaky bucket, and sliding window—in Java microservice architectures, with practical code examples using Guava, Sentinel, Redis+Lua, and a reusable Spring Boot starter.
This article explains Redisson's distributed lock features, comparing it with Jedis and Lettuce, detailing lock acquisition, reentrancy, Lua scripts, watchdog renewal, and the implementation of fair locks using Redis lists and sorted sets, with code examples and architectural insights.
This article explains why a custom business rate‑limiting component is needed, outlines the required rules, chooses Redis + Lua for counting, and provides complete Kotlin/Spring code—including a Detect annotation, Lua scripts, and usage examples—to enforce daily, hourly, and combined limits with real‑time adjustments.
This article explains why distributed locks are needed, describes the five essential characteristics of Redis locks, compares three common implementation methods, and provides detailed Java code examples with watchdog, re‑entrancy, and expiration handling to guide developers in building reliable distributed locking solutions.
This article explains how to use PHP and Redis to create a blocking lock for a game room, safely add users while preventing dirty reads, and release the lock atomically with a Lua script, providing complete code examples and practical tips.
This step‑by‑step guide shows how to prepare an Ubuntu 16.04 system, install all required dependencies, download OpenResty and its optional modules, configure the build with performance‑focused options, compile, install, set environment variables, and create a systemd service for automatic startup.
OpenResty combines Nginx and Lua to create a high‑performance, scalable web platform that lets developers write Lua scripts for handling HTTP requests and backend services, offering non‑blocking I/O, coroutine support, and built‑in modules for databases and caches.
This article details Weimob's migration to APISIX, covering background, performance requirements, benchmark results, architectural analysis, Kubernetes deployment, custom plugin extensions for authentication and rate limiting, remaining challenges, and overall conclusions about the gateway's impact.
This article shares a newcomer’s six‑month experience in game test development, covering automation testing fundamentals, script writing, maintenance practices, tool creation workflows, and cross‑language integration between C#, Lua, PHP, and SQL, offering practical guidance for aspiring test engineers.
This article explains how Redisson implements distributed locks on Redis, covering basic concepts, a simple lock with Lua scripts, reentrancy handling, automatic lock renewal via WatchDog, and the advanced fair lock mechanism that ensures FIFO ordering using Redis lists and sorted sets.
This article introduces Kruise Rollout 0.3.0, explains its new batch deployment, header‑&‑cookie traffic shading, and Lua‑based Ingress extensions, compares it with Flagger and Argo Rollout, and provides detailed installation and usage instructions with code examples for Kubernetes users.
This article explains how to design and implement a business risk‑control component using Redis + Lua scripts and Spring AOP annotations in Kotlin, covering rule definitions, counting strategies, annotation handling, and testing procedures.
The study compares JavaScript (via the JVM engine), Lua, and pure Java for secure, lightweight dynamic scripting in Java projects, finding that native Java is orders of magnitude faster, JavaScript outperforms Lua in complex loops when the engine is reused, while Lua remains suitable for simple scripts but all scripting options are significantly slower than compiled Java.
This article analyzes and compares the routing matching processes of the open‑source API gateways APISIX and Kong, detailing their initialization, rule generation, categorization, matching algorithms, performance testing, and concluding why APISIX's radix‑tree approach yields higher efficiency.
This article explains why a custom business rate‑limiting (risk‑control) component is needed for AI‑driven services, compares open‑source solutions, and provides a complete implementation using Redis+Lua scripts, Kotlin code, and Spring AOP annotations, including testing and deployment tips.
This article explains why a business needs its own risk‑control (rate‑limit) component, compares open‑source options, and provides a complete Kotlin/Spring implementation using Redis Lua scripts, annotations, and AOP to enforce real‑time adjustable limits.
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.
This article presents a comprehensive overview of using abstract syntax tree (AST) based static analysis for Lua code, detailing the motivation, dynamic and static approaches, variable type handling, analysis loops, built‑in functions, closures, metatables, and potential applications in precise testing for game development.
This article explains Redisson's role as a Java in‑memory data grid built on Redis, compares it with Jedis and Lettuce, and details how Redisson implements distributed locks—including simple lock/unlock, Lua‑based reentrant locks, automatic lock renewal (WatchDog), and a fair lock using Redis lists and sorted sets—providing complete code examples and execution flow.
This article explains how to use luaj, a Lua‑Java bridge, to call Java static methods from Lua, pass Lua functions to Java, handle method signatures, check call results, and manage error codes, providing practical code examples for seamless integration.
This article explains the role of API gateways, compares access‑layer and application‑layer designs, and provides a step‑by‑step guide to constructing a dynamic, high‑throughput gateway using OpenResty’s Nginx‑Lua architecture, plugin system, and runtime configuration features.
This article explains how to design a Redis‑based pseudo‑message queue that groups, limits, and batch‑processes game‑level behavior data using Lua scripts, achieving millisecond‑level latency, controlled queue length, and scalable production‑consumer throughput for large‑scale game analytics.
The article details how a gaming data‑reporting pipeline uses Redis lists, sets and Lua scripts to build a pseudo‑message queue that provides per‑game message grouping, fixed‑length queues, and batch consumption while meeting strict timeliness and throughput requirements.
This article explains how to build a precise, persistent delay queue using Redis data structures and Lua scripts, demonstrates a Go client library with code examples for sending, consuming, acknowledging, and retrying delayed messages, and discusses the design requirements such as durability, retry mechanisms, and timing accuracy.
This article explains how to build a reliable delayed message queue using Redis, covering business scenarios, requirements such as persistence and retry, the design of Redis data structures, Lua scripts for atomic operations, and a Go implementation with example code for producing and consuming delayed tasks.
This article explains the Redisson library’s distributed lock implementation in Java, covering its basic concepts, custom lock creation with Lua scripts, reentrant and fair lock mechanisms, the watchdog renewal process, and practical usage examples with code snippets.
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.
This article explains Redisson's in‑memory data grid features, compares it with Jedis and Lettuce, and walks through the implementation of re‑entrant, watchdog‑enabled, and fair distributed locks using Redis Lua scripts and Java code examples.
This article provides a comprehensive, step‑by‑step analysis of Redisson’s distributed lock implementation, covering its architecture, Lua scripts for lock acquisition, re‑entrancy, watchdog renewal, unlocking, fair lock mechanisms, and code examples, enabling developers to grasp and apply robust Redis‑based locking in Java applications.
The Vivo Internet Server team built a Redis‑based pseudo‑message queue that uses per‑game fixed‑length lists, a global game set, and Lua scripts for atomic batch production and consumption, satisfying 128‑behavior batch limits, three‑minute timeliness, and high‑throughput (≈10 k QPS) requirements.
This article explains how to build a reliable delayed message queue using Redis data structures and Go, covering business scenarios, design requirements, key Redis keys, Lua scripts for atomic operations, message lifecycle management, and provides complete source code for implementation.
This article explains JD's design of a billion‑scale vehicle‑part matching cache, detailing the data model, bitmap storage structure, SDS pre‑allocation, key‑value compression, cluster routing, and Lua‑based high‑performance search interface that achieves sub‑13 ms latency.
This article explains how to build a precise, persistent, and retry‑capable delayed task queue using Redis ordered sets, Lua scripts, and a Go client, addressing common e‑commerce scenarios like auto‑closing unpaid orders and sending activation messages.
A detailed post‑mortem of the July 2021 Bilibili outage reveals how a Lua‑induced CPU spike in the OpenResty‑based SLB caused widespread service disruption, the step‑by‑step emergency response, root‑cause analysis, and the subsequent architectural and operational improvements to prevent recurrence.
This postmortem details the July 13, 2021 Bilibili outage caused by a Lua‑induced CPU 100% bug in the OpenResty‑based SLB, describing the incident timeline, root‑cause analysis, mitigation steps, and the subsequent technical and process improvements to enhance reliability and multi‑active deployment.
This post‑mortem details the July 2021 Bilibili outage caused by a Lua bug in the OpenResty‑based SLB, describing the timeline, root‑cause analysis, mitigation steps, and the technical and organizational improvements implemented to prevent similar incidents.
In July 2021 a sudden CPU‑100% spike in Bilibili's OpenResty‑based SLB caused widespread service outages, prompting an emergency response that rebuilt load‑balancer clusters, traced a Lua _gcd function bug triggered by a zero weight string, and led to extensive operational and architectural improvements.
This article details the July 13, 2021 Bilibili service outage caused by a Lua‑based SLB CPU spike, describing the incident timeline, root‑cause analysis of a weight‑zero bug, mitigation steps including new SLB deployment, and the subsequent operational and architectural improvements.
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.
This guide explains how to use OpenResty’s Lua capabilities to replace Tomcat‑based Redis access with direct Nginx‑Redis integration, apply compression to reduce bandwidth, set up periodic cache refreshes, configure single‑worker timers, and manage cache settings via a signed backend API.
The article benchmarks cjson, rapidjson, and yyjson JSON libraries on a 6‑core OpenResty setup, shows that combining rapidjson's encode with yyjson's decode reduces 500,000 mixed encode/decode operations to 11 seconds, and describes a Lua wrapper that adds schema validation and improves maintainability.
This article explains how Redisson builds a robust Redis‑based distributed lock by using Lua scripts for atomic operations, a watchdog to auto‑extend leases, support for re‑entrant, fair, read‑write, multi‑lock and RedLock algorithms, and shows the relevant Java code snippets.
This article explains how to use OpenResty with Lua to integrate Redis directly into Nginx for cache‑driven request forwarding, data compression, timed updates, single‑process scheduling, and configurable URL caching, thereby improving concurrency, reducing latency, and enhancing backend resilience.
The article discusses how to achieve interface idempotency using unique business identifiers or token mechanisms, then explores distributed rate limiting by outlining its dimensions, common algorithms such as token bucket and leaky bucket, and provides concrete implementation examples with Guava RateLimiter, Nginx, and Redis‑Lua scripts.
This article examines common stock‑deduction scenarios in e‑commerce and lottery systems, compares three implementation approaches—single‑row MySQL updates, sharded MySQL rows, and Redis INCRBY with Lua scripts—analyzes their concurrency issues, and provides detailed Java code for a robust Redis‑based solution with distributed locking and serialization considerations.
The article shows how the Lura library uses C++ reflection to build a concise Lua bridge that automatically registers functions, properties, and object lifecycles via userdata and meta‑tables, simplifying bridge code compared to traditional libraries while supporting coroutines and profiling.
The TIOBE index for March 2022 shows Python still at number one, Lua re‑entering the top‑20 while displacing Groovy, and several shifts among languages like Go, Delphi, R, and Swift, with detailed rankings and trends illustrated in accompanying charts.
This article explains how to use OpenResty and Lua to integrate Redis caching, compress responses, schedule periodic updates, and configure URL‑based cache rules directly within Nginx, improving concurrency and resilience of web services.
Learn to protect your server from malicious crawlers by creating a dynamic IP blacklist using Nginx, Lua, and Redis, covering architecture choices, installation steps, configuration snippets, and how to share and update the blacklist across multiple machines.
The March 2022 TIOBE index shows Python retaining the top spot while Lua re‑enters the top‑20, driven by Roblox’s popularity, and provides detailed movements of languages such as Go, Delphi, R, Swift, and MATLAB, along with charts and a full list of the top 100 rankings.
This article explains how to achieve interface idempotency using unique business IDs or token mechanisms and presents comprehensive distributed rate‑limiting techniques—including token‑bucket and leaky‑bucket algorithms, Nginx directives, Guava RateLimiter, and Redis‑Lua scripts—along with practical Spring Boot code examples.
This article explains the concept of interface idempotency, presents practical techniques such as version‑based updates and token mechanisms, and then dives into distributed rate‑limiting strategies covering dimensions, token‑bucket and leaky‑bucket algorithms, and concrete implementations using Guava RateLimiter, Nginx, and Redis‑Lua scripts.
The article explains how Ponder’s C++ reflection library uses template‑based type erasure to register and invoke functions at runtime, detailing the Function class, registration syntax, argument conversion, Lua integration, performance considerations, and a complete Vector3 DotProduct example.
The article introduces a real-time code coloring system for Lua-based game development, explaining its purpose, usage scenarios, core functionalities, data collection methods, architectural design, technical challenges, performance optimizations, and network communication using Django Channels.
This comprehensive guide walks you through Redis basics, its data structures, commands, installation steps, high‑concurrency principles, persistence mechanisms, replication, caching strategies, Lua scripting, pipelines, distributed locks, and cluster concepts, providing practical examples and best‑practice recommendations for developers and operators.
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.
Learn how to leverage OpenResty and Lua to replace traditional Tomcat‑Redis pipelines with direct Nginx caching, compress responses, schedule periodic updates, and configure dynamic URL caching, dramatically reducing latency and improving concurrency for high‑traffic web services.
This article explains how to protect a Spring Boot API from traffic spikes by applying common rate‑limiting algorithms, configuring Redis for distributed throttling, writing Lua scripts for atomic counters, and integrating a custom @Limit annotation with AOP to enforce limits across a cluster.
This article explains how to leverage OpenResty and Lua scripts to integrate Nginx with Redis for direct caching, compression, timed updates, request forwarding, and configurable URL management, thereby improving concurrency, reducing latency, and enhancing the resilience of backend web services.
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.
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.
This article details the architecture of the Qingzhou Business Gateway, identifies its granular control, data‑loss, and performance issues, and explains a series of optimizations—including FFI usage, table‑pool reuse, coroutine caching, radixtree routing, and connection‑pool tuning—that raise single‑node QPS to 80 k while preserving functional capabilities.
An in‑depth post examines a P0 flash‑sale incident where a Redis‑based distributed lock caused severe overselling, analyzes root causes such as lock expiration and non‑atomic stock checks, and presents safer lock release via Lua scripts and alternative designs to prevent similar failures.
This article explains how to build a dynamic IP blacklist using Nginx, Lua, and Redis, covering installation, configuration, Lua scripting, and deployment steps to reject requests from blacklisted IPs while keeping the solution lightweight and shareable across multiple servers.
This article explains a lightweight, loosely‑coupled solution for real‑time monitoring of HLS video playback in vehicle IoT, detailing how to embed device and session identifiers in HLS requests, modify M3U8 files, and collect statistics with NGINX Lua scripts.
This guide explains how to use OpenResty’s Lua modules to let Nginx read and write Redis directly, compress large payloads, schedule periodic cache updates, and configure URL‑based caching, thereby reducing latency, saving bandwidth, and improving overall backend reliability.
This article explains the fundamentals of ACID, how Redis implements transactions with MULTI, EXEC, DISCARD and WATCH commands, provides code examples, and analyzes whether Redis transactions satisfy atomicity, consistency, isolation, and durability.
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.
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.
The article explains how a senior architect uses OpenResty and Lua to let Nginx directly access Redis for caching, compresses large responses, schedules periodic updates, and provides a configurable, signature‑verified caching layer to improve web performance and resilience.
This article explains why Redis can encounter thread‑safety‑like problems, how network latency limits its performance, and how embedding Lua scripts lets you create atomic, server‑side commands that overcome these issues while providing practical code examples.
This article explains how to use OpenResty with Lua to build a high‑performance caching layer that directly accesses Redis, compresses large responses, schedules periodic updates, forwards requests intelligently, and provides configurable URL caching, thereby improving concurrency, reducing latency, and optimizing bandwidth usage.
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.
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.
Learn how Linux’s non‑blocking I/O mechanisms such as select, poll, and epoll enable high‑concurrency servers, explore OpenResty’s Lua‑based architecture, and follow step‑by‑step instructions for installing, configuring, and troubleshooting a performant OpenResty/Nginx environment on Linux.
This guide explains Linux socket programming techniques such as non‑blocking I/O and epoll, introduces the OpenResty platform built on Nginx and Lua, and provides step‑by‑step instructions for installing, configuring, and optimizing high‑concurrency web services with code examples.
This article explains what rate limiting is, why it is needed, the typical actions triggered by limiting, compares single‑node and distributed architectures, reviews four common limiting algorithms, and provides a detailed Redis‑Lua token‑bucket implementation with full source code.
This article examines a real‑world flash‑sale incident where Redis distributed locks failed, causing severe overselling, and presents root‑cause analysis, safer lock implementation with Lua scripts, atomic stock handling, refactored Java code, and deeper reflections on lock necessity and further optimizations.
Idlefish’s new multi‑engine concurrent search architecture replaces the tightly‑coupled single‑engine pipeline with deep engine isolation, asynchronous multi‑engine recall, and unified result merging, cutting dump build time from 14 h to 5 h, shrinking memory use dramatically, improving latency by only ~15 ms, and boosting exposure by 50 % and orders by 33 %.
This article explains the concept of gray (canary) releases, walks through installing Nginx with Lua and memcached modules, shows how to configure Nginx to route traffic based on client IP stored in memcached, and provides testing steps to verify the rollout.
iQIYI’s AR+AI powered video interactive mini‑games blend a custom VideoAR engine with real‑time AI‑driven face and gesture detection, use lightweight Lua for game logic, and offer rapid hot‑updates, enabling diverse IP integrations that have attracted over a million participants and boosted viewer engagement.
This article chronicles the step‑by‑step evolution of Kuaishou's special‑effects authoring tool—from early QWidget layouts through QML redesign, then JSON/Lua configuration, and finally dynamic QML loading—highlighting how each stage reduced code size, improved developer efficiency, and enabled seamless hot updates without app releases.