This guide explains how Linux socket I/O multiplexing (select, poll, epoll) powers high‑concurrency servers, why caching and asynchronous non‑blocking are crucial, and provides step‑by‑step instructions to install, configure, and develop with OpenResty, Nginx, and Lua for scalable backend applications.
This tutorial demonstrates how to use Redis SET operations and a Lua script to implement a lottery mechanism, and shows how to integrate the script into a Java Spring application using Spring Data Redis's RedisTemplate for atomic execution.
This article explains how Redis introduced Lua scripting to combine multiple commands atomically, covers Lua basics, data types, control structures, script execution with EVAL/EVALSHA, script management commands, and practical tips for writing efficient, safe Redis Lua scripts.
This tutorial walks through installing OpenResty, creating a simple hello‑world service, and implementing a practical Lua‑based request routing example that distinguishes single‑ versus multiple‑UID POST bodies, complete with Nginx configuration, Go backend code, and testing steps.
This article explains how Spring Cloud Gateway uses a token‑bucket algorithm backed by Redis and a Lua script to perform distributed rate limiting, reviews common limiting algorithms, provides detailed Java and Lua code examples, and analyzes each step of the implementation for high‑concurrency systems.
This article explains Linux socket programming techniques such as non‑blocking I/O and epoll, discusses caching and asynchronous design for high‑performance servers, and provides a step‑by‑step guide to installing, configuring, and developing with OpenResty (Nginx + Lua) on Linux and Windows environments.
This article walks through configuring Redisson with Maven, demonstrates a simple distributed lock example using Sentinel, lists the Redis commands and Lua script semantics involved, and provides a detailed source‑code analysis of the RLock interface, tryLock, unlock, and forceUnlock methods.
This guide explains how to use Linux non‑blocking socket APIs (select, poll, epoll) and the OpenResty platform (Nginx + LuaJIT) to create scalable, high‑concurrency web services, covering architecture, caching strategies, and step‑by‑step installation and configuration.
This article explains the role of an access‑layer gateway, presents its architecture and implementation using OpenResty, discusses technical selection, details OpenResty’s underlying Nginx/Lua mechanisms, and shows how to achieve dynamic routing, plugin‑based policies, shared data, and upstream configuration without service reloads.
This guide walks you through installing OpenResty—a high‑performance Nginx/Lua web platform—on CentOS, adding a ready‑made Lua WAF module, configuring its various security rules (IP blacklist/whitelist, CC protection, URL, User‑Agent, GET/POST filters), and troubleshooting common issues.
This guide explains Linux socket programming concepts such as non‑blocking I/O and epoll, introduces the OpenResty web platform built on Nginx and Lua, walks through environment setup, configuration, Lua scripting, and common troubleshooting steps for building high‑concurrency backend services.
This article provides a comprehensive overview of using Lua scripts with Redis, covering Lua basics, advantages of Lua scripting, detailed Redis‑Lua integration syntax, command usage, return‑type mappings, script management commands, and step‑by‑step instructions for installing Lua and executing example scripts.
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.
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.
This article explains what rate limiting is, why it’s essential for high‑availability systems, and walks through multiple limiting strategies—including counters, leaky‑bucket, token‑bucket, and a Redis‑Lua approach—culminating in a complete Spring Boot implementation with custom annotations, AOP interceptors, and gateway integration.
This article explains the concept of reentrant distributed locks and provides two Java implementations—one using ThreadLocal for local counting and another using Redis Hash with Lua scripts—detailing the code, pitfalls, and integration with Spring Boot.
This article explains why redoing a system can be simpler than refactoring, then dives into implementing a reentrant distributed lock using Redis with both ThreadLocal and Redis Hash approaches, providing detailed Java code, Lua scripts, and practical tips for handling lock expiration and multi‑process reentrancy.
This article presents a concise Redisson distributed‑lock example with Maven configuration, demonstrates basic lock usage, enumerates the Redis commands and Lua script semantics involved, and provides a detailed walkthrough of the relevant Java source code, highlighting key implementation details.
This tutorial shows how to use the open‑source APISIX API gateway—built on OpenResty and etcd—to create a dynamic rate‑limiting plugin in Lua, configure route matching with a radix tree, and demonstrate the feature with a test endpoint that enforces one request per second and returns HTTP 503 when exceeded.
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.
This article explains what OpenResty is, details its underlying Nginx‑Lua architecture—including Lua coroutines, cosocket, and multi‑stage processing—compares its performance with other web platforms, and describes its practical deployment and multi‑level caching strategy in JD.com's high‑traffic Jshop sale system.
This article details the architectural redesign, fault‑tolerance mechanisms, performance optimizations, and monitoring strategies employed in JD.com’s PC homepage, illustrating how backend technologies such as OpenResty, Lua, Redis, and NGINX are orchestrated to achieve high availability and sub‑30 ms page loads.
VeryNginx, built on the lua_nginx_module, adds a powerful firewall, access statistics, and a web UI to Nginx, with clear installation steps, reverse‑proxy and static‑resource configuration examples, and customizable matching and response rules for security management.
This article introduces Kong, a cloud‑native API gateway, outlines its key features such as high performance, plugin architecture, and traffic control, explains why it solves common microservice challenges, and provides detailed deployment, clustering, plugin development, and troubleshooting guidance with practical code examples.
This article explains how to implement a Redis-based distributed lock using Jedis in Java, covering lock creation with SETNX, lock expiration, safe lock release via Lua scripts, and demonstrates the approach by simulating a 100,000-user concurrent order‑grabbing scenario.
Learn how to replace manual Nginx upstream configuration with automatic service discovery using Nacos, by either writing Lua scripts with the nginx‑lua‑module or building a Java/Golang agent that fetches instance lists via the Nacos API, updates upstream blocks, and triggers hot reloads.
This article details the design and implementation of ADMonitor, a high‑availability, low‑latency advertising monitoring platform built on OpenResty, covering its architecture, data collection, processing, archiving, and performance outcomes.
This article provides a comprehensive overview of Redis, explaining its core data structures, caching use cases, persistence mechanisms, high‑availability features like Sentinel and replication, clustering for horizontal scaling, and client‑side capabilities such as transactions, Lua scripting, pipelining, and distributed locks.
This article explains how to design a high‑concurrency flash‑sale (秒杀) system by leveraging browser and CDN caching, read‑write split Redis for traffic filtering, Lua scripts for atomic stock deduction, master‑slave Redis for fast inventory updates, and Redis‑based message queues for asynchronous order processing.
This article demonstrates how OpenResty can be used in production to implement static and dynamic blacklists, request rate limiting, AB testing, and service quality monitoring by embedding Lua scripts into Nginx, with detailed configuration examples and code snippets.
This article examines three OpenResty-based backend health‑check solutions—ngx_http_upstream_module, lua‑resty‑upstream‑healthcheck, and nginx_upstream_check_module—detailing their implementation principles, configuration examples, node status monitoring, and practical Docker integration, helping developers choose the optimal approach for reliable service availability.
This article demonstrates how to build a distributed rate‑limiting component named shield‑ratelimiter using Redis’s INCR and TTL features, Spring‑Boot‑starter integration, Lua scripting for atomic operations, custom annotations, and AspectJ, providing a robust, configurable solution for limiting API calls in Java backend services.
This article explains block, object, and file storage concepts based on Ceph, describes how front‑end JavaScript resources are migrated to an S3‑compatible object store, outlines the supporting Lua/Nginx combo tool, caching strategies, and step‑by‑step e‑commerce migration procedures.
Learn why inventory over‑selling occurs under high concurrency, and explore three practical solutions—pessimistic locking, optimistic locking with version control, and Redis‑Lua scripting—detailing their implementation steps, advantages, and drawbacks to help you choose the best approach for reliable stock management.
This article explains how OpenResty, built on Nginx and Lua, powers JD Logistics' high‑throughput, extensible gateway by leveraging non‑blocking I/O, plugin architecture, multi‑level caching, dynamic load balancing, and custom JSON handling to achieve stable, scalable performance.
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.
This guide explains how to create a dynamic IP blacklist using Nginx, Lua, and Redis, covering the background, architecture options, step‑by‑step implementation, and the advantages of a lightweight, shared, and easily updatable solution.
This article explains how to build a high‑performance red‑packet (hong‑bao) service by configuring a RedisTemplate in Spring, writing an atomic Lua script for stock management, persisting results to a MySQL database via JDBC batch processing, and using @Async to off‑load long‑running tasks, complete with code examples and deployment steps.
This article explains how to build a high‑concurrency flash‑sale (秒杀) system by separating static page traffic with CDN, using read‑write‑split Redis for early request filtering, applying Lua scripts for atomic inventory deduction, and employing Redis as a simple message queue for asynchronous order persistence.
This guide introduces Lua’s concise syntax, tiny footprint, and performance strengths, explores typical use cases such as security, web APIs, and game servers, then walks through core language features, OpenResty integration, deployment steps, and a hands‑on exercise for building a redirect service.
Oceanus is Meituan’s Nginx‑based HTTP routing framework that abstracts routing policies, stores them in MySQL, updates them asynchronously, evaluates Lua‑rendered conditions at runtime, and dynamically switches upstream groups without Nginx reload, enabling flexible traffic control for flash‑sale testing, regional isolation, gray releases, and other complex scenarios.
This guide compiles resources and key concepts on OpenResty, Lua‑based Nginx development, asynchronous programming models, microservice API gateways, and related plugins, providing a structured roadmap for backend engineers to deepen their understanding and practical skills.
This article explains how embedding Lua scripts into Nginx via the lua‑nginx module can address PHP’s limitations in service stability and response time, detailing the problems, requirements, and practical code examples that demonstrate asynchronous handling and bigpipe‑style page rendering.
This article explains how to correctly implement a Redis-based distributed lock in Java, covering essential reliability requirements, step‑by‑step code for acquiring and releasing locks, and detailed analyses of common flawed approaches, ensuring atomicity and proper ownership handling.
This article explains the design of a Redis‑based rate‑limiting system, covering core concepts, token‑bucket and window‑based algorithms, Java and Lua implementations, engineering choices, performance benchmarks, and practical lessons learned.
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.
This article describes the background, design concepts, selection rationale, implementation principles, algorithm details, and configuration of a Lua‑based overload protection module for Nginx that monitors system load and dynamically rejects traffic to safeguard backend services.
This article explains why rate limiting is essential for service performance and data security, and demonstrates two practical Redis-based implementations—a Lua script approach and a Redis‑cell module method—complete with code examples, usage details, and a brief comparison.
This article explains how to design a robust, zero‑intrusion data fallback component for high‑traffic web services using Nginx, Lua, and AOP principles, covering problem definition, architectural options, detailed execution steps, configuration snippets, storage choices, and performance monitoring.
Exploring how a securities firm processes billions of daily stock‑market indicators in real time, this article compares an in‑process Redis + Lua solution with an out‑of‑process Goroutine‑based architecture, detailing data flow, performance trade‑offs, and scalability considerations for high‑frequency time‑series workloads.
This article explains a practical approach to implementing hot‑update in Unity games by injecting Lua‑based patches into C# methods using SLua and the NRefactory library, detailing the execution environment, code‑injection process, Lua patch creation, and a reusable MethodInjector class.
This article explains how to implement access‑layer rate limiting in Nginx using built‑in modules, OpenResty Lua extensions, and token‑bucket or leaky‑bucket algorithms, with detailed configuration snippets, execution flow, testing procedures, and log analysis for robust traffic control.
This guide explains how to use simple Nginx configurations, enhanced cookie checks, and Lua scripts to create unforgeable tokens, limit request rates, and protect web services from CC attacks, scanning tools, and other malicious traffic while maintaining normal user access.
This article introduces the advantages of Nginx and Lua, explains the ngx_lua module and OpenResty ecosystem, describes common architectural patterns such as load balancing and caching, and provides a step‑by‑step guide to building, configuring, and deploying a Lua‑based web application on Nginx.
This article explains how to design a gray‑release solution for HTTP read interfaces by using either Nginx with embedded Lua scripts or a version‑aware gateway layer, detailing rule design, configuration handling, and the trade‑offs of each approach.
The article details JD.com's technical strategies for scaling product detail pages under massive traffic, covering service decomposition, KV‑based dynamic rendering with Nginx+Lua, unified service gateways, isolation, caching, monitoring, degradation, and performance testing to achieve sub‑50 ms response times.
This article explains how Redis Lua scripting can make operations faster, cut network overhead, guarantee atomic execution, and enable script reuse, and it provides practical examples including a simple hello‑world script and a URL‑shortening implementation.
This article walks you through designing, installing, and configuring a custom WAF using Nginx and Lua (OpenResty), covering core modules, pain points of native Nginx security, code examples, deployment tips, and future enhancements for robust web protection.
This article details JD.com's evolution of product detail page architecture—from early IIS/C# monoliths to a distributed, cache‑heavy, Nginx+Lua system—covering front‑end dimensions, performance metrics, design principles, scaling challenges, storage engine choices, multi‑datacenter deployment, and the lessons learned from numerous production pitfalls.
The article presents a comprehensive overview of OpenResty, describing its architecture, suitable scenarios, selection criteria, real‑world adoption at Qihoo 360 and Sina Mobile, onboarding challenges, future roadmap, and community efforts, illustrating why it is a powerful backend solution for high‑throughput services.
This article describes how to create a “fastest‑first” load‑balancing algorithm for NGINX using OpenResty and Lua, including the design principles, modifications to lua‑upstream‑nginx‑module, weight‑adjustment logic, Docker build steps, and practical considerations for handling latency‑based server weighting.
This article describes JD’s unified service architecture for the product detail page that handled tens of billions of requests during Double Eleven, detailing the multi‑level caching strategy, Nginx+Lua access layer, service isolation, degradation mechanisms, and front‑end logic offloading.
This article explains how aspect‑oriented programming can be applied to a backend system by separating cross‑cutting concerns such as request encryption, authentication, and permission handling using Sinatra extensions and Nginx Lua scripts, resulting in a modular, low‑coupling architecture.
This article explains how to apply aspect‑oriented programming principles to a Ruby‑based API service by extracting cross‑cutting concerns such as request encryption, authentication, and permission checks into Nginx Lua middleware, enabling low‑coupling, scalable backend modules.
This article reviews the various dynamic deployment techniques for iOS apps—Web App, Hybrid App, React‑Native, Lua/Javascript patches, and JSON‑described views—analyzes their pros and cons, and proposes a JSBridge‑based microservice architecture as the most practical solution.
This article explains SQLite's Virtual Database Engine (VDBE) architecture, its LR‑based grammar compilation using Lemon, compares it with Lua's virtual machine, and details the instruction set, execution flow, and stack versus register implementations.
This article details the evolution and redesign of JD.com’s product detail page architecture, describing the transition from static HTML generation to a dynamic, high‑performance, multi‑datacenter system built on key‑value storage, Nginx + Lua, asynchronous processing, multi‑level caching, and robust scaling and reliability strategies.
This article explains how to embed the Lua scripting engine into native C programs, Java applications via LuaJava, Android apps using JNI, and iOS projects, covering environment setup, bridge functions, compilation commands, and runtime examples for each platform.