Servers and deploys
Dedicated and backup servers, how a game picks a server, Backup rooms on the Rust room, updates, bots on a server, protection and capacity.
Where your game runs, how it picks a server, and what an update does to a game that's already running. The whole system: How TagBalls is built. Today's settings and capacity: Server settings and capacity.
How it works now
- Backup: one Durable Object per game on Cloudflare, in all six regions (Cloud in the code and on the Ops page). Players see it as Backup Server: used when no Dedicated Server is free or near, and its clock can pause briefly.
- Dedicated: our own servers in four regions, one dedicated core each: US West (Los Angeles, fixed), US East (New York area), Europe (Amsterdam) and Oceania (Sydney). The autoscaler created and set up the last three on 16 Nov 2026; all three answered on the current build with 0 boot warnings. Each runs two Node processes side by side, up to 8 games. Competitive public games and ranked games go there; on All regions, a player in a region without a server can land on one when it's under 180 ms away.
- No server: Asia Pacific, and South America, which is a Backup-only region.
- Scale to zero (replaced 22 Nov 2026: all four regions stay on, see [Server settings and capacity](/wiki/server-settings)): since 18 Nov 2026 a region's server can be removed when idle, per region; US West stays on. The first player in a region with no server up plays on the nearest running server while the near one starts, is told it is starting and when it is ready, and moves at the end of a game (Stay here keeps them). A new server took 1 min 59 s from being made to taking rooms (Oceania, 19 Nov 2026; 2 min 38 s before the setup was cut).
- Backup on the Rust room: built, off, trial pending (below).
- Capacity: 8 games of 4 v 4 (64 players) at the strict bar: the server 23% busy, longest pause 14.3 ms, ticks late p99 1.9 ms (measured on the server, 17 Nov 2026).
- Sockets: uWebSockets.js with one write per player a tick: an 8-person game costs 0.137 ms a tick on the server.
- Spectators: Up to 16 spectators a game, every kind of game; people waiting for a seat count, staff don't. A game with all 16 greys its Spectate in the Games list, and a join to spectate it is refused with another game to spectate offered.
- Bots: think in their game; when the server is busy, the game with the most bots (3 or more) hands its thinking to a bot brain on Cloudflare.
- Deploys: the new build starts beside the old one, which finishes its games and exits within 45 minutes.
Last checked: 16 Nov 2026.
Key decisions
| Decision | Why | Rejected | Date |
| Competitive and ranked games on Dedicated where a region has a server | A real clock: its tick is never more than 1 ms behind. Its address is DNS-only: the browser read 6 ms against 53 on Cloud in the same minute | Cloudflare's Pro plan (prioritises routing, promises no location; not tried) | 16 Nov 2026 |
| Joins, accounts, matchmaking, records and the site stay on Cloudflare | Nothing unique lives on a server, so a lost one is replaced from the same scripts | None recorded | 16 Nov 2026 |
| Two processes per server; the old one finishes its games | No game cut by a deploy: rooms close between games and players are back in a second or two | Restarting in place, which dropped every game (the bug) | 16 Nov 2026 |
| 8 games on the one-core server | The limit is single long pauses on the shared event loop, not CPU, and 8 meets the strict bar | 12 games (longest pause 22.9 ms) and 16 (37 ms) | 17 Nov 2026 |
| uWebSockets.js, one write per player a tick | Sends were 39% of a room's CPU on Node's ws | ws, kept as the fallback (ROOM_WS=ws) | 16 Nov 2026 |
| Hand bots to a bot brain only while busy, and only games with 3 or more bots | A people's game with a stand-in or two always thinks on the server; handed off, a game of 1 person and 7 Expert bots costs the server about half | Always on the brain (a server setting, not the default) | 16 Nov 2026 |
| Rooms in Cloudflare Containers: built, off | Built as a real clock inside Cloudflare; the Dedicated server went live the next day | None recorded | 15 Nov 2026 |
| Scale idle servers to zero, the farther server first | Three idle regional servers cost about $82 a month for no rooms; a far game first and a short move later beats a wait | A server always on in every region | 18 Nov 2026 |
| Backup games on the Rust room in a container: built, off, a 7-day trial first | The same program as Dedicated, a few dollars a month at low traffic, and no clock pauses | The Rust room compiled to WebAssembly in a Durable Object (about 45 to 60 worker-hours); Dedicated only, with wakes in every region | 19 Nov 2026 |
| Autoscaling on (AUTOSCALE, in the Worker's secrets) | Servers come and go with players, with no manual setup; World creates them through the provider's API | The provider's own autoscaling (it has none for plain servers) | 16 Nov 2026 |
| Dedicated CPU only, never shared | A shared core lends its time to other customers, and the strict bar fails on one late tick; the config and the relay refuse a shared plan | Shared-CPU plans | 16 Nov 2026 |
| Start each server at 1 core, grow to 2 when busy | A region whose server peaks at 60% of its rooms on 3 of 7 days moves to 2 dedicated cores, and back after 14 quiet days | Starting at 2 cores everywhere | 16 Nov 2026 |
| A relay on our own server holds the provider's key | The key never sits in the Worker; the Worker asks the relay to create or delete a server | The provider key as a Worker secret | 16 Nov 2026 |
Changes that mattered
- 19 Nov 2026: a new server reports how long each stage of its start took and installs in one pass, players are told when a server near them is starting and when it is ready, a far seat's wake survives a deploy, and a first boot waits for the package lock. The bug
- 19 Nov 2026: a Hangout room or a place open for more than a day no longer ends at a deploy. The bug
- 18 Nov 2026: idle regional servers scale to zero, the first player plays on the nearest running server while the near one starts, and the Ops costs count servers by the hour. The bug
- 16 Nov 2026: Dedicated servers in US East, Europe and Oceania, created and set up by the autoscaler on its third attempt; create and delete both proven; all three on the current build with 0 boot warnings. The first failures, the second
- 16 Nov 2026: a new server downloaded a bundle that hadn't been uploaded again; deploys now fail loudly when it isn't. The bug
- 16 Nov 2026: the first autoscaled servers never finished booting: a first boot's strict file permissions left the proxy's package key unreadable to the package installer. Setup now runs under the normal permission mask, the strict one only while secrets are on disk, and a failed boot reports its last log lines and is removed at once. The bug
- 16 Nov 2026: a one-core server went from 4 to 8 full 4 v 4 games at the strict bar once its long pauses were fixed. How many games one server holds
- 16 Nov 2026: a game changing map no longer hitches every game on its server: map change steps of 30 to 105 ms became 9 to 14. The bug
- 16 Nov 2026: sockets on uWebSockets.js, one write per player a tick: 0.204 to 0.137 ms a game-tick. Room server sockets
- 16 Nov 2026: a big account's join ticket is accepted (refused at 16 KB before, so its games went to Cloud). The bug
- 16 Nov 2026: a deploy resumes a game instead of dropping it. The bug
- 16 Nov 2026: a game no longer leaves the Dedicated server for Cloud during a deploy, and picks trust health answers up to 2 minutes old. The bug, and this one
- 16 Nov 2026: US West's Dedicated server goes live for competitive and ranked games. Two US servers outside Cloudflare
- 16 Nov 2026: Cloudflare measured accepting connections in Los Angeles and handling many far away (263 to 334 ms round trips). Ping spikes from Cloudflare routing, the bug
Known limits and next
- Asia Pacific and South America have no Dedicated server: their games are on Backup, with its clock pauses (Known rough edges).
- Every game on a server shares one event loop, so one long pause makes every game's next tick late.
- The front (TLS) takes 30 to 38% of the server's CPU.
- After a failed boot, the retry waited on the relay's hourly create limit and the scaler's own 60-minute wait after a refusal; both are being reshaped so failed boots count apart from growth.
- Backup rooms on the Rust room in Containers: built, off, trial pending (variable RUST_BACKUP). WebTransport on Dedicated: built, off (switch WEBTRANSPORT_LIVE).
- A new server's start: 33 s of installs and about 15 s between the machine booting and its setup script are left to cut.
Where games run
| Backup | Dedicated |
| What it is | A game room on Cloudflare, started near its first player | A game room on our own server: a Rust or Node process with a real clock |
| Regions | All six: US West, US East, Europe, Oceania, Asia Pacific, South America | US West (Los Angeles), US East (New York), Europe (Amsterdam) and Oceania (Sydney): one server each, up to 8 games at once |
| Which games | Every game a Dedicated server doesn't take | Competitive public games (public games, bot games, a group's public game), ranked games, custom games, cup matches and scrims |
- Mini-games go to a Dedicated server only while it's under half its limit, otherwise Backup.
- Places and Hangouts go to a Dedicated server only while more than half its rooms are free, otherwise Backup.
- Always Backup: profile rooms, group lobbies and the editor's shared sessions.
- Custom games, cup matches and scrims go to a Dedicated server when one has room: your region's first, else the nearest within about 90 ms (by your measured ping when the page has one). A server keeps its last 2 rooms for public games; without room, Backup. The host can pick Backup (Server, in the lobby) or their own computer.
- Everything around the game stays on Cloudflare: joins, accounts, matchmaking, records, the store and the site.
The same game code runs on both. A Dedicated server's clock is real time, so its ticks go out on time; on Backup a room's clock can pause for a moment (Known rough edges).
How a game picks a server
- Your region comes from where you connect, or from Settings, Server.
- On All regions (the default), if no one is playing within about 90 ms of you, you join the nearest region that has people, up to about 250 ms, and the game shows the ping to expect. My region only keeps you at home.
- For a new competitive game, World asks each Dedicated server in the region how it's doing (an answer at most 3 s old, with 1.5 s to answer). It picks the one with the fewest games that isn't full, isn't finishing its games and runs this version of the game.
- On Automatic in a region without a Dedicated server, a player who finds no game to join gets a new game on the nearest Dedicated server within 180 ms. London to US West is about 116 ms.
- Your page gets the server's address and a ticket signed by the site, good for a minute, and moves its connection there.
- If no server fits, or the server closes before its first message, the game is on Backup. You see a normal join either way.
One game per account holds across Dedicated and Backup, and kicks, bans and mutes reach Dedicated games too.
Backup rooms on the Rust room (built, off, trial pending)
Today every Backup game runs the TypeScript room in a Durable Object, with its clock pauses. The plan: Backup games run the Rust room, the same program as the Dedicated servers, in a Cloudflare container per place, so they get a real clock too. The TypeScript room stays as the last resort.
- Placement: a Dedicated server first, then an awake or woken place, treated like a Rust server (health, features, map check), then the TypeScript room for what the Rust room doesn't play or when a place fails. Players still see Backup Server.
- Cold start: the first game in a sleeping place waits with "Starting a Backup Server": 0.66 s locally, warm joins 15 to 18 ms (19 Nov 2026). A place sleeps about 10 minutes after its last room.
- Cost (Cloudflare's prices, 19 Nov 2026): about $0.02 an hour awake, so $2 to $4 a month at 100 to 200 awake hours; about $10 a month kept warm.
- The trial: one setting names one place for 7 days, to prove the real cold start, each place's city, the bots reaching their brain, ticks at a quarter of a core and the bill. Removing the setting sends new Backup games back to the TypeScript room at once.
The corner readout
The game's corner shows where it runs beside your ping, and dims with the HUD: "US West · Dedicated · 24 ms" or "Oceania · Backup · 180 ms". The Games page, the scoreboard and the Joiner settings say the same, with a Dedicated server's city ("US West · Los Angeles · Dedicated Server"; in the corner on hover), and the Games page and the status page list every region with its servers: a Dedicated server's games against its limit ("6 of 8 games", "at capacity"), and the games and people on backup servers ("Asia Pacific · Backup server · 2 games, 9 playing"). A game on a player's computer says "Hosted by" and their name instead. Dedicated server and Backup server are the only names used; a custom game's Server switch says Dedicated or Backup.
Updates and a game in progress
- Dedicated: a server runs two processes side by side. An update starts the new build in the second one. The old one takes no new games and finishes the ones it has: each of its games closes between games, and your page dials the same game again by itself and lands on the new process with your seat and team. The old process exits once it's empty, within 45 minutes.
- Cloud: only a game deploy reaches them. A running game keeps the code it started with, and new games start on the new code. A room still on old code restarts only at a calm moment (empty, warming up or counting down), and players are back in a second or two. More: Data and saving.
- Both: before a planned update, games show it 15, 5 and 1 minute ahead, and updates wait while people are playing (How we ship).
Bots on a Dedicated server
- Bots think in their game, on the server, while it has room to spare.
- When the server is busy (its CPU over 60% of its core, or its event loop 20 ms late, for 5 s), the game with the most bots hands its bots' thinking to a bot brain on Cloudflare, one game every 5 s.
- When it's quiet again (under 35% and 8 ms for 30 s), the thinking comes back, one game every 5 s.
- Only games with 3 or more bots are handed off, so a people's game with a stand-in or two always thinks on the server.
- If the brain stops answering, the game takes the thinking back within 15 s. The bots never leave the game for it.
Handed off, a game of 1 person and 7 Expert bots costs the server about half as much: its CPU a tick p50 went from 0.99 to 1.09 ms thinking in the room to 0.42 to 0.51 ms. That was measured on a Mac busy with other work (load 27 to 50), so the times read high. More: Where bots think.
How a server is protected
- Only the ports for the site and for administration are open.
- Every address is limited before any work is done: too many open connections, too many new ones a second, or too much sent before or after joining, and it's refused.
- The game process runs in a locked-down sandbox: no special rights, a read-only system, a memory cap.
- Administration is by key only, and security updates install every day.
- Nothing unique lives on a server. A lost server is replaced by a new one from the same scripts.
- If a flood takes a server off the network, new games go to Backup after about 1.5 s, and games that were on it start again on Backup.
Capacity
A server takes at most its game limit (10 per core by default; 8 on US West's one-core server) and none while the machine is low on memory. Then it says it's full and new games go to Backup. How it's measured:
- The room benchmark (
scripts/bench/room-bench.ts): rooms in one process with scripted people and Expert bots over real sockets. It reports CPU per room per tick, tick times, memory, collections a minute and a hash of everything sent, so two builds can be shown to play exactly the same game. - The load test (
scripts/bench/box-load.sh): a spare copy of the live build on the real server, on its own ports behind its own copy of the front, with scripted players on the server, so no player can land on it. Each step adds games, settles 45 s and measures 3 minutes against the strict bar. A guard throws away any window in which the live games had players or a deploy started. - The bot brain benchmark (
scripts/bot-brain-bench.ts): 1 person and 7 Expert bots, thinking in the room against handed off. - The soak test (
scripts/host-soak-test.ts): a local Worker and two servers through rolling updates and a stopped server, checking that no game is cut. On a laptop busy with other work, 32 people in 4 games: ticks late p99 2.4 to 4.3 ms on Dedicated, no gaps over 50 ms.
Measured on US West's server (one virtual CPU), 17 Nov 2026:
| Games at once | Box busy | Longest pause | Ticks late p99 | At the strict bar |
| 8 of 4 v 4 (64 players) | 23% | 14.3 ms | 1.9 ms | yes |
| 12 of 4 v 4 | 33% | 22.9 ms | 2.0 ms | no |
| 16 of 4 v 4 | 43% | 37 ms | 2.4 ms | no |
| 4 with 1 person and 7 Expert bots | 12% | 10.8 ms | 1.9 ms | yes |
| 8 with 1 person and 7 Expert bots | 17% | 32.4 ms | 2.0 ms | no |
- What limits it isn't CPU but single long pauses: every game on a server shares one event loop, so one pause makes every game's next tick late. Garbage collection, the process waiting for the core while it sends, and one piece of bot data are what's left.
- A game of 8 people costs 0.82% of the core (0.137 ms a tick), a game with 7 bots 1.5%. Each player gets 11.5 to 12 KB/s on the wire.
- The front (TLS) takes 30 to 38% of the server's CPU.
- The limit stays at 8 games. The story: Servers: sockets, pauses, capacity. Every table: Server measurements; the Containers backup: Room measurements.
Dedicated in detail
- The ticket: the Worker answers your page with the server's address and a ticket signed with a shared key, good for a minute, naming the room and your account. Your page moves its connection there, only ever to an address on the site's own domain.
- The same room: a Dedicated server runs the same room code, takeover and the bot level policy included. The clock mend and room heal stay off there, since its clock is real.
- Bots: a server's BOT_BRAIN setting can also send its bots to a bot brain on Cloudflare always, not only while busy (Where bots think).
More: why competitive games run on Dedicated servers, and why there is no proxy in front of the rooms: Server measurements. How TagBalls is built, Where bots think.