Room measurements
Every measurement of rooms on Cloudflare: clock falls, the room tick, bot cost and levels, the bot brain, Containers.
Every measurement behind rooms on Cloudflare (A game tick, How bots think), moved here from the devblog post Rooms on Cloudflare Durable Objects. Measured 13 to 16 Nov 2026.
Measured how: staging rooms with scripted players on the live wire format; Node profiles with a fixed seed so a run repeats exactly and a hash proves a change sends the same bytes; thread CPU summed over 250 ms windows (the gap between pings). Node numbers ran at load average 7.7 to 35 on a shared Mac, each tick the least of 3 runs where stated.
The clock falls, and why
| Staging, 8 scripted players and 4 spectators | No bots | 8 Expert bots |
| Stalls (a tick 40 ms or more late) | 0 | |
| Worst gap between sends | 19 ms | |
| Tick lateness p99 | 2 ms | |
| Data per player | about 13 KB/s | |
| Room clock falls of 40 ms or more | 3 to 4 a minute, 40 to 94 ms | 6.3 a minute, up to 126 ms |
Staging, 15 Nov 2026.
The room’s own work is 5.5 ms per 250 ms at p99 (physics 70%, encoding 13%, sending 12%; the update is encoded once and the same bytes go to every socket). That can’t explain falls of 40 to 94 ms with no bots: they are the platform’s scheduling. A live room with 1 player and 3 bots fell 183 ms while the bots’ thinking was 1.6 ms at p99. On shared compute a room can still pause 40 to 200 ms a few times a quarter hour.
What softened it
- The clock mend: it reads how far behind the room is from players’ pings and runs the missing ticks, repaid at 0.25 ms per ms so the catch-up never comes out as a burst (a catch-up takes about four times as long as the fall). Its third round reads the lowest ping instead of each one, so one slow ping no longer looks like a jump.
- Your own ball drawn at an even moment, so a catch-up shows as a moment more delay, not your ball speeding up (Netcode).
- Room heal: more than 6 falls a minute (a room without bots stays under it), or more than 6 windows with 15 ms or more of bot thinking, past the first 30 s with bots at least half the balls, and every bot plays one level lower for the rest of that game. Once a game, never back up mid-game, with a chat line. One level is a big step: 8 bots’ worst first-game window is 25.4 ms at Expert, 10.7 at Elite.
The room’s own tick
With 8 people and no bots the rules are about 80% of a tick and physics about 15%; with 4 Expert bots the bots are about 70%; with real sockets sending is about half, 5 µs a send; the once-a-second tick costs about twice a plain one. Fixes: powerup flags read by name instead of a keyed loop over kind names (about 20 times faster, checked against the old table), powerup ends written out instead of iterating all 27 kinds, one buffer a tick for every socket’s frame, and idle bot chat and buttons that stop allocating when there’s nothing to do. A tick of 8 people went from 0.050 to 0.040 ms and garbage from 26 to 11 KB a tick; over 5 minutes the collector paused 4 to 5 times with people and about 25 with bots, under 0.3 ms a second (load 8 to 18).
Earlier (15 Nov): ticks run against the clock instead of a repeating timer, the update goes out before stats, chat and highlights, and updates send only what changed with a checksum on every frame (about 30% less data per player).
Bots: bursts, first games and the level table
- Trimming searches that couldn’t change their answer cut think time after an event from 0.52 to 0.29 ms, every decision identical.
- A strict per-room thinking budget cut the heavy windows but cost play (bots with it won 40% ± 12 of 60 ladder games): off. Spreading thinks over fixed phases measured nothing.
- An Expert bot’s first game on a map in a fresh process cost 2 to 5 times its later ones (one Expert on tp-asida: 12 to 15 ms worst window first, 2.3 to 2.8 in the next three; heavy windows 20 to 40 s in and around 90, 104 and 154 s). Not caches: V8 threw Expert’s pad lineup and juke searches out of optimized code the first time a game took an unseen branch (25 ms of the worst window against 4 ms replayed). Different games settle only after about 8 (8 Expert on tp-asida: 19.4 ms first, about 7.5 from the eighth). An Expert game on another map first removed the early windows, not the later ones; an Elite game first removed none.
- Warm-up (an offscreen Expert game during the countdown) helped only with 1 or 2 bots and its own windows cost 47 to 75 ms: not shipped.
- The fix that worked: searches bounded per think in work, not time, so a game replays identically. One snipe lineup per think from a queue (chasers had run up to three lineups of 51 tries, 220,000 simulated ticks in a window), carriers’ 162-move juke searches (27,000 to 91,000 ticks) kept, and three of a grapple’s eight aims plus the last pick. Splitting the juke search over two thinks won 46.3% ± 5.1 of 360 games: off. As shipped the bots are level with the old ones, 49.4% ± 4.4 over 480 games.
- The first cut was reverted: a bot grazed a bomb trigger by 0.0002 tiles on the server, the page’s guess drew it just inside, and a bomb was shown then taken back. Pages now guess another ball’s bomb only 0.1 tiles inside the trigger.
The level table: a level fits a bot count if its worst 250 ms window times 3 (Cloudflare runs 3 to 4 times slower than Node here) stays under the 40 ms where the clock falls, 13.3 ms in Node. Maps: the two heaviest of the rotation scan, tp-asida and tp-bezoar, plus tp-wamble for neutral flag. Single runs under load measured 1.4 to 2 times higher than the least of 3.
| Bots | First table (one game a map) | Now (12 games, bounded searches) |
| 1 | Expert 9.9 ms (74%) | Expert 8.4 ms |
| 2 | Elite 3.1 (Expert 24.3) | Expert 8.4 |
| 3 | Elite 7.0 (Expert 18.8) | Expert 11.0 |
| 4 | Elite 9.1 (Expert 21.5) | Expert 11.2 |
| 6 | Elite 8.2 (Expert 22.5) | Expert 11.7 |
| 8 | Elite 10.7 (Expert 25.4) | Expert 12.8 |
| 9 or more | Elite (12: 11.0; Expert 38.7) | Elite (Expert with 10: 16.5) |
Worst 250 ms of thread CPU in Node, first games in a fresh process; the line is 13.3 ms. At 4x, 8 and 12 Elite were 7 to 10% over; Regular loses 98.3% ± 2.3 of games to Elite (120 games), too weak for a stand-in, so 3x it is. Warm, Expert fit every count up to 12 (8.3 ms with 12). Source: docs/bench/bots/policy.md.
Bots in their own object
A room with bots opens one socket to a BotBrain object named after it, so it starts in the same place. After each tick the room sends its state (about 360 bytes for 8 balls); keys come back before the next tick, one tick behind the state as when the room thinks (sent at the start of the next tick they were two behind). The brain keeps an unstepped copy of the room and runs the bots’ own code. A bot whose keys are over 4 ticks old is thought for by the room, which retries the socket 120 ticks later.
| Bot brain, Node, 8 Expert bots | Room thinks | Brain thinks |
| Room step p50 / p99 | 0.76 / 2.26 ms | 0.38 / 1.87 ms |
| Brain per state | | 0.63 ms, 354 bytes a tick |
| Ladder, brain against room-thought Expert | | 48.8% ± 8.9 of 120 games (keys 1 tick behind); 43.3% ± 8.9 at 2 ticks |
| Room tick at a takeover join, 3 games | 10.3 / 5.0 / 2.9 ms | 1.7 / 0.5 / 0.5 ms (brain open from the countdown) |
| Worst 250 ms after that join | 16.0 / 9.6 / 6.7 ms | 7.4 / 2.8 / 3.0 ms |
Brain on a worker thread. The worst 250 ms in the step test was about 60 ms either way (load 19 to 23). Takeover rows at load 5 to 7; a fresh map’s bot data took up to 175 ms before the brain built it on arrival.
The route to the room
From a US West home network a traceroute reached Cloudflare’s Los Angeles site in about 6 ms, yet Cloudflare’s trace page showed the request handled at Dublin on 10 of 12 tries (5 of 8 in another sample), the others Tokyo, Vienna or Los Angeles. Round trips: 9 to 44 ms handled at Los Angeles, 263 to 334 ms far; a player’s readout swung 45, 280, 140, once 700. The room’s sends stayed within 19 ms of each other. The cause is Not known (the domain’s plan governs it; a paid plan was not tried). Our own server’s address skips the proxy: 4.7 ms raw.
What replaced it
For competitive US West games, a box of our own with a real clock: Servers: sockets, pauses, capacity. Cloudflare Containers were prepared as the other way and stay off. Kept warm, a month: 1/4 vCPU and 1 GiB $13 to $25 for 1 region, $39 to $75 for 3, $65 to $125 for 5; 1 vCPU and 2 GiB about $25 to $72, $75 to $216, $125 to $360; standard-2 (1 vCPU, 6 GiB) $51 to $98, $153 to $294, $255 to $490 (half to full CPU, Cloudflare’s prices, Nov 2026). A region scaled to zero costs a few dollars, data out adds about $1 a month per player always in a game, and a vCPU holds about 10 busy bot rooms or 30 to 40 human rooms; a quarter vCPU only suits rooms without bots.
Room stalls from recompiles
From the devblog post One database object under load, 13 Nov 2026. Lag spikes every 30 or 60 seconds: V8 dropped a function’s optimized code when a game reached an unseen branch, and recompiling the bots’ main function and the room’s step took 60 to 130 ms. Splitting them (35 to 15 KB, 24.5 to 7 KB) and keeping one shape per object fixed it. A 16 v 16 room with half bots averages 0.62 ms a tick.
The backup: Containers
Public games are people only, with a bot only standing in for someone who left, so rooms with people in them run close to the no-bot numbers above. Also prepared and switched off: Cloudflare Containers, which run a container attached to a Durable Object, placed by Cloudflare, scaled to zero when idle. A container has a real clock and a size we pick, so a region's rooms could run in one with the same code as today.
| Type | vCPU | Memory | Disk |
| lite | 1/16 | 256 MiB | 2 GB |
| basic | 1/4 | 1 GiB | 4 GB |
| standard-1 | 1/2 | 4 GiB | 8 GB |
| standard-2 | 1 | 6 GiB | 12 GB |
| standard-3 | 2 | 8 GiB | 16 GB |
| standard-4 | 4 | 12 GiB | 20 GB |
Prices: CPU $0.00002 per vCPU-second while active, memory $0.0000025 per GiB-second, disk $0.00000007 per GB-second, billed in 10 ms steps; Workers Paid includes 375 vCPU-minutes, 25 GiB-hours and 200 GB-hours a month (Cloudflare's pricing page, Nov 2026: https://developers.cloudflare.com/containers/pricing/). One container per region, kept warm, a month (the range runs from half to full CPU):
| Container | 1 region | 3 regions | 5 regions |
| basic: 1/4 vCPU, 1 GiB | $13 to $25 | $39 to $75 | $65 to $125 |
| custom: 1 vCPU, 2 GiB | about $25 to $72 | about $75 to $216 | about $125 to $360 |
| standard-2: 1 vCPU, 6 GiB | $51 to $98 | $153 to $294 | $255 to $490 |
A region scaled to zero when no one plays costs a few dollars. Data out adds about $1 a month per player who is in a game all the time. Capacity: about 10 busy bot rooms or 30 to 40 human rooms per vCPU; a quarter vCPU only suits rooms without bots, since a smaller CPU makes each burst last longer.
How rooms would move:
- The room host's Node code (docs/ROOM-HOST.md: the same game room with a real timer) runs in the container.
- The Worker still answers a join with a signed ticket naming the room, the account and how it was matched, and the page moves its connection there.
- Accounts, matchmaking, records, Find a game, groups and ops stay where they are, in the Worker and its objects.
When to switch: if the clock falls are still felt after the render-side smoothing, or when a region holds more rooms than one Durable Object's CPU carries cleanly. A strict per-room work budget for bots cut the falls but cost play (bots with it won 40% ± 12 of 60 ladder games), so it stays off. The story: Where the game runs and what comes next.