How to Simulate 10 Billion WeChat Red‑Packet Requests on a Single Server

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.

Java Interview Crash Guide
Java Interview Crash Guide
Java Interview Crash Guide
How to Simulate 10 Billion WeChat Red‑Packet Requests on a Single Server

Introduction

The author was inspired by a 2015 article about building a reliable "Spring Festival Gala" red‑packet system and decided to recreate a similar high‑load backend to handle 10 billion shake‑red‑packet requests.

Background Knowledge

Key terms: QPS (queries per second), PPS (packets per second), shake‑red‑packet (client requests a random red packet), send‑red‑packet (system creates a packet and assigns it to users).

Goals

Support at least 1 million concurrent connections on a single machine.

Achieve a peak QPS of 60 000 (targeting 30 000–60 000).

Process 83 shake‑red‑packet requests per second per machine (scaled to 200 per second for the test).

Support user‑to‑user red‑packet sending at 200 packets per second.

System Specifications

Hardware: Dell R2950 servers (8‑core, 16 GB RAM) running Ubuntu 12.04; client VMs on ESXi 5.0 (4 CPU, 5 GB RAM each, 17 instances). Software: Golang 1.8r3, shell, Python for monitoring.

Implementation

Connections are divided into multiple SETs, each managing a few thousand connections, reducing goroutine count and lock contention. A single goroutine per connection reads messages and forwards them to a SET‑level queue. Red‑packet generation runs at a fixed rate, and SETs distribute packets fairly.

Alias ss2=Ss –ant | grep 1025 | grep EST | awk –F: "{print $8}" | sort | uniq –c

Monitoring

Custom Python scripts combined with ethtool collect per‑second request counts and network packet statistics, visualized with gnuplot. Logs from both client and server are aggregated for analysis.

Results

Three test phases were run: 30 k QPS, 60 k QPS, and peak 140 k QPS. The system sustained 30 k QPS stably; at 60 k QPS occasional spikes and network packet loss caused fluctuations. Overall, the prototype met the design goals, processing billions of requests in under 12 minutes with 600 servers.

Conclusion

The prototype demonstrates that a single‑machine backend can handle 1 million users and up to 60 k QPS, successfully simulating the shake‑red‑packet and send‑red‑packet workflows of a large‑scale messaging platform.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

simulationGolangred packethigh-concurrency
Java Interview Crash Guide
Written by

Java Interview Crash Guide

Dedicated to sharing Java interview Q&A; follow and reply "java" to receive a free premium Java interview guide.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.