Tagged articles
red packet
27 articles · Page 1 of 1
This article explains how to design and implement a WeChat group red packet feature, covering database schema, non‑cached and cached workflows, concurrency control with Redis locks, and two allocation algorithms—random distribution and double‑average method.
Allocation AlgorithmRedis LockWeChat
0 likes · 11 min read

This article examines three main algorithms—ordinary random, double‑mean, and line‑segment—for distributing WeChat red packets, provides PHP implementations, validates the randomness of array_rand, and compares their performance to guide developers in choosing a fair and efficient solution.
PHPbackend developmentrandom algorithm
0 likes · 11 min read


DevOpsJun 12, 2024 · Backend Development
This article examines four common WeChat red packet distribution algorithms—simple random, double‑mean, line‑segment division, and array_rand optimization—explaining their principles, PHP implementations, performance characteristics, and how to verify randomness, providing code samples and comparative analysis for developers.
AlgorithmBackendPHP
0 likes · 13 min read

This article examines the main algorithms behind WeChat's red‑packet distribution—plain random, double‑mean, and segment‑split (including an optimized version), explains their PHP implementations, validates array_rand's randomness, and compares their performance and fairness through code examples and timing tests.
PHParray_randperformance
0 likes · 12 min read

This article dissects WeChat's group chat system, covering its functional and non‑functional requirements, high‑level architecture, face‑to‑face group creation, message transmission, storage design, and the real‑time red‑packet allocation algorithm implemented in Go.
GoWeChatgroup chat
0 likes · 20 min read

This article dissects the design of WeChat's group chat system, covering functional and non‑functional requirements, high‑level component architecture, database schemas, face‑to‑face group creation, real‑time messaging, red‑packet algorithms, and Go code implementation, revealing how massive concurrency, performance, and storage challenges are solved.
Backend ArchitectureGoWeChat
0 likes · 22 min read

This article explains how WeChat engineered a high‑concurrency backend to support billions of shake‑to‑receive red‑packet requests during the Spring Festival Gala, detailing the prototype system, challenges, iterative solutions, and the final production version that processed over 110 billion shakes with peak loads of 14 million requests per second.
Backend ArchitectureWeChathigh concurrency
0 likes · 18 min read

This article details the architecture, challenges, and solutions behind a high‑traffic Spring Festival shake‑and‑red‑packet system, covering prototype design, bandwidth and request‑rate handling, access clusters, overload protection, and iterative versions that achieved up to 110 billion shakes with peak loads of 14 million requests per second.
BackendLoad Balancinghigh concurrency
0 likes · 17 min read

During the 2022 Chinese New Year, WeChat leveraged Serverless cloud functions and cloud development to handle the explosive demand of red‑packet cover creation, achieving sub‑ten‑thousand‑yuan costs, supporting over 100 million daily calls, and delivering rapid, scalable, and cost‑effective deployment for developers.
Cloud FunctionsWeChatcloud development
0 likes · 7 min read

This article details a practical backend engineering experiment that reproduces the massive load of 100 billion WeChat red‑packet requests by simulating one million concurrent users on a single machine, covering target metrics, hardware/software choices, architecture, implementation steps, performance testing, and analysis of the results.
Backend ArchitectureGoLoad Simulation
0 likes · 18 min read

This article explains how the author designed and implemented a Go‑based backend that can simulate up to 100 million concurrent users and process billions of red‑packet requests, detailing the hardware setup, performance goals, load‑balancing techniques, monitoring, and the results of multi‑stage stress tests.
Simulationgolanghigh-concurrency
0 likes · 17 min read

This article details the design of a red packet calculation and distribution system for a Spring Festival promotion, addressing mixed-type packet computation, seamless transition to awarding, distributed task processing, stability guarantees, and successful implementation results.
Fault ToleranceSpring Festivalbatch processing
0 likes · 12 min read

This article explores how understanding and leveraging user emotions—through theories like the SCARF model, emotional value concepts, and behavioral design—can optimize red‑packet collection flows, increase user motivation, and improve overall product experience.
Emotional DesignPsychologySCARF model
0 likes · 10 min read

This article demonstrates a PHP class that implements the WeChat red packet splitting algorithm, explaining the constraints, providing a complete source code example, and showing how to instantiate the class to distribute a total amount into a specified number of packets with a minimum value.
AlgorithmBackendMoney Splitting
0 likes · 6 min read

This article details a practical experiment that reproduces the load of 100 billion WeChat red‑packet (shake‑and‑grab) requests by simulating 1 million concurrent users on a single machine, achieving peak QPS of 60 k and demonstrating the architectural choices, hardware setup, and monitoring techniques required for such high‑throughput backend systems.
GoQPShigh‑throughput
0 likes · 18 min read

This article explains how to fix red‑packet over‑issuance bugs using optimistic locking with CAS, introduces version fields to prevent ABA problems, shows DAO, service and controller code updates, and demonstrates time‑based and count‑based retry strategies to improve success rates under high concurrency.
BackendCASConcurrency
0 likes · 14 min read


21CTOApr 12, 2017 · Cloud Computing
This article explains how Alibaba Cloud designed a high‑performance local storage solution—leveraging Virtio‑blk, SPDK, and NVMe SSDs—to meet the massive peak pressure, ultra‑low latency, and high IOPS demands of the Alipay red‑packet business, and how the technology is now available in the public cloud.
Alibaba CloudNVMeSPDK
0 likes · 12 min read

The article analyzes the massive scale of Chinese New Year red‑packet activity on WeChat, presents usage statistics, and explains the backend architecture—including distributed KV storage, cache‑layer atomic operations, and database transaction handling—that enables high‑throughput red‑packet distribution.
Backend ArchitectureCacheWeChat
0 likes · 5 min read

The article explains how WeChat’s Red Packet service scales to billions of transactions by employing front‑end traffic control, stateless CGI, caching, asynchronous processing, and a highly available MySQL‑based storage layer featuring read/write separation, sharding, hot‑cold data segregation, and multi‑active cross‑region deployment.
MySQLWeChatred packet
0 likes · 10 min read


21CTOApr 23, 2016 · Backend Development
This article examines the massive 2015 WeChat Red Packet traffic, detailing its core functions, system challenges, cross‑region networking, lossy service design, set‑model construction, concurrency handling, and data‑consistency strategies that kept the platform stable under extreme load.
Data ConsistencyWeChatred packet
0 likes · 9 min read


21CTOApr 16, 2016 · Backend Development
This article explains how WeChat redesigned its red‑packet system for the 2016 Chinese New Year, detailing north‑south data separation, multi‑layer caching, asynchronous settlement, high‑concurrency controls, sharding strategies and graceful degradation to handle billions of red‑packet requests.
CacheWeChatbackend scaling
0 likes · 13 min read


21CTOFeb 14, 2016 · Backend Development
This article explores the logic behind WeChat's red‑packet random algorithm, outlines the required constraints, and provides step‑by‑step PHP code that generates fair, varied payouts for a fixed total amount among multiple recipients.
BackendPHPWeChat
0 likes · 6 min read


21CTODec 17, 2015 · Mobile Development
This tutorial explains how to create an Android AccessibilityService plugin that automatically detects and clicks all WeChat red packets, detailing its stage‑based logic, screen‑content detection, node handling, queue management, and provides complete source code for educational use.
AccessibilityServiceAndroidWeChat
0 likes · 14 min read


21CTONov 14, 2015 · Backend Development
This article explains the backend architecture behind WeChat’s red‑packet feature, detailing how the system stores packet data, uses cache‑level atomic operations for grabbing, separates claim and settlement steps, and ensures high‑throughput, fault‑tolerant processing during peak usage.
BackendCacheConcurrency
0 likes · 6 min read


21CTOOct 1, 2015 · Backend Development
This article dissects the entire WeChat red‑packet ecosystem, exploring why users send and grab packets, the entry points, detailed UI screens, database schema, random‑distribution algorithms, caching strategies, and the full front‑end/back‑end interaction sequence.
Backend ArchitectureUI flowWeChat
0 likes · 25 min read

This article explains how to generate red packets, calculate random amounts, and handle user grabbing and opening actions while ensuring high‑concurrency safety using atomic CAS operations in a cache to prevent oversubscription.
AlgorithmBackendCAS
0 likes · 3 min read

The article explains how WeChat’s backend handled the massive surge of red‑packet traffic during the 2015 New Year by employing loss‑tolerant services, flexible availability, modular design, asynchronous processing, and overload protection to ensure fast, accurate, and stable user experiences.
Backend ArchitectureLossy ServiceWeChat
0 likes · 9 min read
