Ready for a crowd
13 Nov 2026
- We moved busy work off World, the object that holds every account. Staging then stayed healthy with 4,000 simulated players online, where 1,500 had failed before (p95 117 ms against 10,111).
- Players saw lag spikes every 30 or 60 s. V8 was recompiling 2 big functions, 60 to 130 ms each time. We split them up, and the spikes stopped.
- A room tick for 16 v 16 with half of them bots takes 0.62 ms on average, so custom games now go up to 16 a side.
When a room with a tiny average cost spikes every 30 to 60 s, suspect the JIT. Keep hot functions small and give each object one shape.
One Durable Object, called World, holds every account, map and purchase. Every game room is its own object, created near its first player, so rooms scale on their own. World does not scale, because it answers one request at a time. On 13 Nov we measured how far it goes, and we moved the busy work elsewhere.
Off World
- An edge cache answers public lists that are mostly read, from the Worker’s memory, for a few seconds to a minute.
- Each tab makes one combined poll that carries presence, the online numbers, chat and the games lists, only as often as what is on screen needs.
- Presence moved to 8 shards, and global chat moved to its own object.
- The daily checks moved off World too. Before that, the site froze for up to a minute every few minutes.
We tested on a staging copy with simulated players. Before the change, 1,500 players online had failed (p95 10,111 ms, 14.7% errors). After it, 4,000 players held at p95 117 ms with no errors, and a second round on the same day stayed healthy up to 8,000. The full table, and the later work on statements per request and ids, is in One database object under load.
Room stalls
Players saw lag spikes every 30 or 60 seconds. V8 caused them. When a game reaches a branch that V8 has not seen, V8 throws away the function’s optimized code and compiles it again. The bots’ main function and the room’s step were so big that each recompile took 60 to 130 ms. We split them up (35 KB to 15 KB, and 24.5 KB to 7 KB) and kept each object to one shape. That fixed the spikes, and nothing about the game changed.
A room’s tick is cheap. A 16 v 16 game with half of the players bots takes 0.62 ms on average. So custom games now go up to 16 a side. Later, rooms ran into the platform’s clock; that is in Rooms on Cloudflare Durable Objects.
Deploys that warn first
Every deploy restarts the game servers. Staff now schedule an update notice. Pages show when the update comes and about how long the game will be down, and a deploy can be rolled back. A page stuck on the update screen drops its cache and loads fresh from its second try. How deploys work now is in A deploy chain for parallel workers.