By BluffKing · · Updated
Local Load Test at 1,000, 3,000 and 10,000 Players
From 1,000 to 10,000 players, server p99 stayed under 0.1ms and end-to-end p99 rose from 0.8ms to 3.4ms. The real bottleneck was a write queue when everyone left at once.
On 19 November 2026 we ran the same game server on one Mac with 1,000, then 3,000, then 10,000 players seated at tables at once, with three minutes of steady play at each size. Players went up tenfold, yet the server’s p99 time to process an action stayed under 0.1ms, and the p99 from sending an action until everyone at the table received it rose only from 0.8ms to 3.4ms. The real problem showed up not during play but in the 45 seconds when all 10,000 players left at once: the Texas Hold’em write queue piled up to about 5,500 jobs and took about two minutes to clear. The same day we repeated the 1,000-player run in production: server processing p99 was 0.37ms and end-to-end p99 was 116ms, nearly all of the gap being network. That night we also held 3,000 players locally for two hours: server processing p99 stayed at or below 0.07ms in every game, end-to-end p99 was 1.2ms, and there were 0 errors and 0 lost connections. The next morning we took production to 1,000 and then 3,000 players. At 3,000, end-to-end p99 was 178ms, inside the 300ms target, but the 2-vCPU host’s CPU stayed at 90–97% and the run’s safety rule stopped it after about 52 minutes: 3,000 players is the practical ceiling of that machine, not a comfortable operating point. The 10,000-player size was not run in production.
How we measured
All three sizes use the same load script. Only the player count changes, and every other parameter scales from the 1,000-player baseline:
- 1,000 players: Zha Jin Hua 80 tables × 5, Hold’em 50 tables × 6, Niuniu 60 tables × 5, 190 tables in all.
- 3,000 players: 1,000 in each game, 567 tables (1,000 is not a multiple of 6, so Hold’em uses 166 six-seat tables plus one four-seat table).
- 10,000 players: 3,335 Zha Jin Hua, 3,330 Hold’em, 3,335 Niuniu, 1,889 tables.
Every seat is its own test account that only plays: no lobby browsing, no history pages. The load generator runs 6 processes per 1,000 players (6, 18 and 60), so each process always drives about 167 players, and the only things that change are how many players, joins and actions the server sees. Each size gets 150 seconds of players arriving, 30 seconds to settle, a 180-second measured window and 45 seconds of everyone leaving, with no disconnect-and-reconnect churn.
The server is the same optimized build as production, running natively on the Mac (Apple M5 Pro; the 3,000- and 10,000-player runs used commit 18c05b1f7 and the 1,000-player run e5999da6b, whose server code differs only in an admin alert email change) with its async runtime pinned to 2 worker threads, the same setting as the 2-core production machine. PostgreSQL runs in a 4-core VM on the same Mac, and the load processes run there too, over loopback. So there is no public internet, TLS or reverse proxy here: these numbers describe what the server itself can handle, not what a player feels on a phone, and not production capacity.
We track two measures. Server processing runs from the server receiving an action until it has handled it and queued the broadcast; it is recorded in 10-microsecond histogram buckets, and the table shows the upper edge of the bucket holding p99. End to end runs from the load client sending an action until every seat at the table has received and decoded it. Both count only the measured window: 180 seconds here, 7,200 seconds in the two-hour run below.
Results
| 1,000 | 3,000 | 10,000 | |
|---|---|---|---|
| Tables | 190 | 567 | 1,889 |
| Online during window (minimum) | 1,000 | 3,000 | 10,000 |
| Game actions per second | 99.6 | 303.4 | 1,012.2 |
| Hold’em hands finished per second | 0.83 | 2.89 | 9.40 |
| Server processing p99 (slowest of three games) | 0.10ms | 0.07ms | 0.07ms |
| End-to-end p50 | 0.4ms | 0.3ms | 0.3ms |
| End-to-end p95 | 0.6ms | 0.5ms | 2.7ms |
| End-to-end p99 | 0.8ms | 1.2ms | 3.4ms |
| End-to-end max | 3.3ms | 2.4ms | 7.2ms |
| Errors during window | 0 | 0 | 0 |
| PostgreSQL CPU (cores) | 0.10 | 0.08 | 0.26 |
| Load-process event-loop p99 | 1.5ms | 1.4ms | 1.4ms |
At every size, everyone stayed online throughout, every player made moves and every table finished real hands; the three games looked about the same individually as combined. Server processing time does not grow with players because each action is very little work. 0.10ms against 0.07ms is a few histogram buckets, so do not read it as “more players, faster server”. The end-to-end tail does grow, with p95 going from 0.6ms to 2.7ms. Our guess is that 2 worker threads take turns writing broadcasts to 10,000 connections, so more time is spent waiting in line, but we did not collect thread-level data to confirm it. The load processes’ own event-loop p99 stayed at 1.4–1.5ms at every size, so the load generator was not the bottleneck and these numbers measure the server.
What the test exposed
At 10,000 players the write queue grew as soon as the measured window ended. Within the 45-second departure, the hosts of 555 Hold’em tables each asked their other players to leave (2,360 “stand after this hand” events in the log) while 3,330 Hold’em connections closed. Pending Hold’em writes went from at most 3 in the once-a-minute samples during the window to about 5,500 within half a minute of the departure starting, with writes from all 555 Hold’em tables waiting in line. All 555 of the hosts’ requests to remove players got a 503 asking them to refresh the table, and about 500 Hold’em action acknowledgements timed out during the departure (none during the measured window). Because removals were refused, this size failed the check that every test account’s seat is released at the end. The queue cleared about two minutes later with 0 failed and 0 lost writes.
We have not pinned the root cause yet. The structural factor we can see is that Hold’em hand records, table-state snapshots and several other kinds of writes share 4 global database write slots (WRITE_SLOTS in server/src/session_persistence.rs). That is enough in normal play; when a burst of writes arrives, every table waits in the same line. One more clue came from an earlier 10,000-player run on a debug build: the same backlog appeared right after players finished arriving, during steady play. The debug build is much slower, which says this write path has little headroom with 10,000 players playing continuously. The 10,000-player size ran for only three minutes, so this does not show that this write path can sustain a full hour at that size; the two-hour run below was at 3,000 players.
Ten thousand players leaving within 45 seconds is unlikely in practice, but the bottleneck it exposed is real. Next we will find out what holds the write slots and why the queue recovers so slowly, then rerun the same three sizes after the fix.
Production rerun: 1,000 players
That evening (from 19:15 Singapore time) we ran the same script, the same 1,000-player mix and the same schedule (150 seconds arriving, 30 to settle, 180 measured, 45 leaving) against production while it was serving real players, on the release built from commit 2b8dbf961. Production is one 2-core cloud host behind a TLS reverse proxy. The load processes ran on a Mac connected over Wi‑Fi and the public internet.
| Local, 1,000 | Production, 1,000 | |
|---|---|---|
| Online during window (minimum) | 1,000 | 1,000 |
| Game actions per second | 99.6 | 95.2 |
| Hold’em hands finished per second | 0.83 | 0.85 |
| Server processing p99 (slowest of three games) | 0.10ms | 0.37ms |
| End-to-end p50 | 0.4ms | 47.5ms |
| End-to-end p95 | 0.6ms | 106.6ms |
| End-to-end p99 | 0.8ms | 116.0ms |
| End-to-end max | 3.3ms | 132.5ms |
| Errors during window | 0 | 0 |
| PostgreSQL CPU (cores) | 0.10 | 0.28 |
| Total server CPU (app + database + proxy, cores) | — | 0.61 of 2 |
Server processing p99 was 0.37ms in production, higher than locally but far below the 10ms bar. All 1,000 players stayed online, every table finished real hands, every test seat was released afterwards and there were no errors in the window. End to end is a different story: p50 was already 47.5ms, roughly one network round trip from the load machine to the server. During the window we also pinged the Mac’s Wi‑Fi gateway: p50 4.2ms but p99 75.5ms, which suggests much of the tail between p50 and p99 comes from the first Wi‑Fi hop rather than the server. Percentiles from two measurements cannot simply be subtracted, so this is only a direction, not a breakdown.
The production bar is server processing p99 under 10ms and end-to-end p99 under 300ms. The end-to-end bar is looser than locally because it includes the public-internet round trip from the load machine to the server, about 45ms on its own. This 1,000-player run met both. It was only a three-minute check, though, shorter than a production capacity acceptance requires, so it shows the two latency bars were met, not a full capacity pass; in a separate one-hour, 1,000-player production test the same day, server processing p99 was 0.25–0.42ms and end-to-end p99 was 128.6ms. Real players were online during the test, so larger sizes had to be measured step by step at another time; the production runs at 1,000 and 3,000 players the next morning are below.
Two hours at 3,000 players (local)
Three minutes of steady play is short, so the same night (16:58–18:58 UTC on 19 November, 00:58–02:58 on 20 November Singapore time) we held the 3,000-player mix locally for two hours. The server was the optimized build of commit 345650b75, again with 2 worker threads, on a MacBook Pro (18 cores, 48 GB) against the local PostgreSQL database that holds our 1-million-user seed. The load came from 18 load processes on the same Mac, over loopback. The mix was the same 567 tables: 1,000 Zha Jin Hua players at 5-seat tables, 1,000 Hold’em players at 166 six-seat tables plus one four-seat table, with hole cards delivered through sealed dealing, and 1,000 Niuniu players at 5-seat tables. Every seat had its own account and everyone played: 150 seconds arriving, 30 to settle, then a 7,200-second measured window, with no reconnect churn and no lobby browsing during play.
| 3,000, three minutes | 3,000, two hours | |
|---|---|---|
| Measured window | 180 s | 7,200 s |
| Server build | 18c05b1f7 | 345650b75 |
| Game actions per second | 303.4 | about 304 |
| Hold’em hands finished per second | 2.89 | 2.82 |
| Server processing p99 (slowest of three games) | 0.07ms | 0.07ms |
| End-to-end p50 | 0.3ms | 0.3ms |
| End-to-end p95 | 0.5ms | 0.7ms |
| End-to-end p99 | 1.2ms | 1.2ms |
| End-to-end max | 2.4ms | 10.4ms |
| Errors during window | 0 | 0 |
Server processing p99 over the two hours was 0.07ms for Zha Jin Hua (626,033 actions), 0.06ms for Hold’em (469,149) and 0.07ms for Niuniu (1,091,758), against a bar of 10ms; as above, these are the upper edges of 10-microsecond buckets. End to end, across 2,186,946 samples, p50 was 0.3ms, p95 0.7ms, p99 1.2ms and the slowest single action 10.4ms, with p99 at 1.2ms in each of the three games, against a local bar of 100ms. This is loopback only, with no real network in the path, so it is not what a player on the internet feels.
During the hold the server handled about 304 actions per second (65.2 Hold’em, 238.6 Zha Jin Hua and Niuniu together) and sent about 3,064 WebSocket frames per second to the clients, finishing 2.82 Hold’em hands per second. 47,185 hand records were written to the database with 0 failed and 0 lost, and sealed dealing delivered 121,396 sets of hole cards. All 3,000 players signed in and were seated, there were 0 errors and 0 lost connections, every table and every player kept producing acknowledged actions for the full two hours, and every seat was released at the end. The server process averaged about 27% of one CPU core. Its resident memory went from 3.76 GB at the start of the hold to 3.99 GB at the end, about +200 MB in the first hour and about +30 MB in the second, so growth was flattening out. The figure is large locally because the in-memory user directory loads the 1-million-user seed.
Some caveats. All simulated players share 127.0.0.1 locally, so we raised the per-IP and per-account per-minute request budgets for this run; production keeps them, because each real player has their own IP. Our first attempt was invalid for exactly that reason: the shared address ran into those limits. Hand-persistence backpressure warnings appeared only during the bursts of players arriving and leaving, none during the hold. Two hourly background anti-collusion queries took between 150ms and 1.3s and did not move play latency. So this run shows that one server with 2 worker threads kept 3,000 players playing for two hours on this Mac with 0 errors, and that its whole-run latency percentiles were in line with the three-minute run (end-to-end p99 1.2ms in both). It does not show production capacity, does not include the public internet, and says nothing new about the 10,000-player write backlog above. Production capacity is the next section.
Production at 1,000 and 3,000 players
On the morning of 20 November Singapore time (1,000 players from 23:39 UTC on 19 November, 3,000 from 00:12 UTC on 20 November) we ran the same workload shape against production: the top-3 games, one test account per seat, no lobby browsing, and the same table mixes as above. Production is one Tencent Cloud server in Hong Kong with 2 vCPUs (AMD) and 4 GB of memory; the game server, PostgreSQL and the Caddy reverse proxy all run on that one machine. The load came from a Mac on Wi‑Fi over the public internet, so end to end includes the Wi‑Fi hop and the internet round trip: a p50 of about 47–50ms is mostly that round trip, and in one 5-minute window the Mac’s own Wi‑Fi gateway ping had a p99 of about 112ms. Real players were online throughout; the load used separate test accounts. The targets were the production bars from above, server processing p99 under 10ms and end-to-end p99 under 300ms, and the run stops itself if the whole host’s CPU goes above 95% busy.
| Production, 1,000 | Production, 3,000 | |
|---|---|---|
| Server release | b1f88e922 | a63e23bab |
| Time at full load | about 11 minutes (stopped by us) | 3,099 s, about 52 minutes (safety stop) |
| Server processing p99 (range across server snapshots) | 0.18–0.35ms | 0.18–0.42ms (Hold’em 0.18–0.19, Zha Jin Hua 0.39–0.42, Niuniu 0.36–0.38) |
| End-to-end samples | 63,172 | 890,130 |
| End-to-end p50 | 47ms | 50.5ms |
| End-to-end p95 | 108ms | 119ms |
| End-to-end p99 | 121ms | 178ms |
| End-to-end max | 325ms | 619ms |
| Connections lost | 0 | 0 |
| Whole-host CPU busy (load-driver sampling) | at most about 34% | about 83% on average |
| CPU cores: game server / PostgreSQL / proxy | about 0.25 / 0.25 / 0.06 | about 0.78 / 0.60 / 0.14 |
| Outbound bandwidth | about 1.8 Mbit/s | peak 7.6 Mbit/s |
1,000 players ran on release b1f88e922. We stopped it ourselves after about 11 minutes at full load to move on to 3,000, so it is not a one-hour result. In that time server processing p99 was 0.18–0.35ms, end-to-end p99 121ms over 63,172 samples, 0 connections were lost, the host was at most about 34% busy and outbound traffic was about 1.8 Mbit/s. The server figures come from periodic server snapshots; because the run was stopped early, the final snapshot window was never closed.
3,000 players ran on release a63e23bab, with the production cap on simultaneous WebSocket connections raised from 1,200 to 4,500 for this test. 1,000 Zha Jin Hua, 1,000 Hold’em and 1,000 Niuniu players sat at 567 tables; all 3,000 were seated and 0 connections were lost. We planned to hold for an hour. After 3,099 seconds (about 52 minutes) the whole host’s CPU reached 95.3% busy and the run’s safety rule stopped it. Up to then, server processing p99 was 0.18–0.19ms for Hold’em, 0.39–0.42ms for Zha Jin Hua and 0.36–0.38ms for Niuniu, again from periodic snapshots whose final window the stop left unclosed. End to end, the pooled p99 over 890,130 samples was 178ms, and 174–181ms in each game, within the 300ms target. The server handled about 287 actions per second (63.6 Hold’em, 223.6 Zha Jin Hua and Niuniu together) and finished 2.75 Hold’em hands per second; 23,539 hands were saved with 0 failed and 0 lost.
Resources at 3,000 tell the real story. The load driver’s sampling put the whole host at about 83% busy on average (game server about 0.78 cores, PostgreSQL about 0.60, proxy about 0.14). The cloud console, sampling differently, showed CPU sustained at 90–97% for the whole run. Everything else had room: memory peaked at 85% (3.0 GB of 3.9 GB), outbound bandwidth peaked at 7.6 Mbit/s, about 14% of the 50 Mbit/s cap, and disk I/O wait stayed at or below 1.5ms.
The stop itself was a second stress test. When it made about 1,000 Hold’em players leave at the same moment, about 1,660 hand saves queued at once, and several hundred stand-up requests were refused with a 503 or answered slowly until the queue drained, which took about a minute. All test seats were released afterwards. This is the same kind of burst as the local 10,000-player departure above, at a smaller size: a mass leave at once, not steady play, is where the write path is stressed.
So on this 2-vCPU host, 1,000 players use about a third of the CPU. 3,000 players stay inside both latency targets but leave no CPU headroom, so 3,000 is the practical ceiling of this machine rather than a comfortable operating point. The limit is CPU, not bandwidth, memory or disk, and PostgreSQL takes a large share of it. What these two next-morning runs do not show: neither held a full hour (1,000 was stopped at about 11 minutes, 3,000 by the safety rule at about 52), the load came from one Mac on one Wi‑Fi network rather than many phones on many networks, the test players only played and did not browse the lobby as real players do, and 10,000 players were not run in production.
Takeaways
- Scale the load generator with the load. Our first 3,000- and 10,000-player runs used only 12 and 30 load processes instead of 6 per 1,000 players. Those numbers happened to hold up (the load processes were not busy), but only “change the player count, scale everything else” makes each size directly comparable with the baseline. The script now rejects configurations that break the ratio.
- Do not test only the steady state. Three minutes of steady play passed every check; the trouble came from bulk operations like players arriving and leaving. The departure phase needs acceptance criteria too.
- Debug and optimized builds behave very differently. The debug build backed up during steady play; the optimized build only backed up during the mass departure. Draw performance conclusions from the same build as production and treat debug runs as diagnostic clues.
- Check per-IP limits before blaming the server. When every simulated player comes from one address, per-IP budgets that are right for production will throttle the test instead. Our first attempt at the two-hour run was invalid for exactly this reason; raise the budgets for the local run and say so.
- Passing the latency bars is not the same as having headroom. At 3,000 players in production every latency target held while CPU sat at 90–97%; the automatic stop on host CPU, not latency, ended the run. Watch host resources alongside latency, and give every production load run a stop rule.
- Loopback numbers are not player experience. At the same 1,000 players, server processing p99 was 0.10ms locally and 0.37ms in production, not far apart, while end-to-end p99 went from 0.8ms to 116ms, almost all of it network. A local run measures the server; public-internet experience needs its own test, and the measurement point has to be checked first: when the load machine is on Wi‑Fi, ping the gateway at the same time as a control.
The table mixes are defined by top3Specs in scripts/performance-capacity-plan.mjs, the load-process ratio is enforced in scripts/performance-capacity-options.mjs, and the entry point is scripts/performance-1000-online.mjs; choose a size with --mix=top3-1000, top3-3000 or top3-10000.