Fewer background requests to the site
19 Nov 2026
- With one player online for a day, the site’s main service handled 81,608 requests. About half came from game servers asking the same questions on timers.
- In a local test with five game server processes and one person playing, the count scaled to a day fell from 69,408 to 9,072 requests.
- Game rooms re-sent their status every 2 seconds because of a bug. Room reports fell from 24,624 to 4,320 a day in the same test.
- A game server process with no rooms now makes 0 requests an hour to the main service, against 211 before. A test fails if it makes more than 20.
Our hosting provider bills and limits the site by request, and the count grew with every game server process we added, not with players. An idle game server now costs the main service nothing.
TagBalls has one small always-on program that holds accounts, matchmaking and the list of games. We call it the main service here. Game servers, open pages and our own staff pages all send it requests in the background. This post is about cutting the requests that did not come from play.
The situation
On a day with one player online, the main service handled 81,608 requests in 24 hours. The top five sources that day were these:
- The guest chat setting: 24,089 requests.
- Presence sync, which tracks who is online and on which page: 19,592 requests.
- Room reports, where each game room tells the site its status: 9,178 requests.
- The map rotation: 8,186 requests.
- The waiting line poll: 3,584 requests.
About half of that day’s requests came from game servers asking the same questions on timers, not from the one player.
Why it mattered
Our hosting provider bills and limits the site by request. Its free tier allows 100,000 requests a day, and we are on the $5 a month plan. The count grew with every game server process we added, not with players, so an idle game server cost as much as a busy one.
What we changed
- Room reports. Every game room re-sent its status report every 2 seconds instead of only when something changed. This was a bug. The report included the time the current phase of the game ends, and that time moved by a few milliseconds each time it was read, so the report always looked changed. We now round that time to the whole second. A room reports when something changes, plus a heartbeat every 20 seconds, and all rooms of one game server process go in one request. The site now waits for 60 seconds of silence before it drops a room from the list, instead of 20.
- The guest chat setting and the map rotation. Every game server process asked for the guest chat setting every 20 seconds and for the map rotation every 60 seconds, whether or not it had any rooms. The answer to a room report now carries the guest chat setting and a version number for the rotation. A busy process learns of a change within seconds, and an idle process asks nothing. Processes on one server share one saved copy.
- Presence. The online tracker posted to the main service every 5 seconds, even when nothing had changed. It now sends only what changed, such as someone new or a page change, and sends each person again once 60 seconds have passed since their last update.
- The maintenance switch. Each game server process asked every 2 seconds whether the site was in maintenance. Our hosting provider answers this at its edge, so it never reaches the main service, but it still counts as a request. In the test setup that was 215,423 requests a day. A process with no rooms now asks every 30 seconds, and the same setup made 50,256.
- Staff pages. Our staff pages kept polling while hidden in a background tab. They now pause.
Old and new versions together
Game servers update after the site, so old and new versions talk to each other for a while. We tested both directions with real processes before shipping. A new game server with an old site falls back to the old requests. An old game server with a new site is answered as before.
A regression test now fails if an idle game server process makes more than 20 requests an hour to the main service. The new build makes 0, and the old build made 211.
The result
Measured how: we ran the real site code with five game server processes on one machine and one person playing in a room. We counted requests for 10 minutes before the change and 10 minutes after, and scaled each count to a day.
| Requests a day, by route | Before | After |
|---|
| Room reports | 24,624 | 4,320 |
| Presence sync | 17,280 | 2,880 |
| Guest chat setting | 17,280 | 0 |
| Map rotation | 5,760 | 0 |
| Game server stats | 2,880 | 288 |
| All routes | 69,408 | 9,072 |
Local test: five game server processes on one machine, one person playing, 10 minutes each way, scaled to 24 hours.
We also have an early live reading. In the first quiet hour after the change, on 19 Nov, nobody was playing, and the main service handled 243 requests, about 5,800 a day. Of those, 65 came from our own staff dashboard, 55 from outside uptime checks and 73 from one open browser tab’s polls. Only 7 were presence syncs and 6 were room reports. That hour had no players, so it does not compare directly with the day of 81,608 requests. We will add a full day with play to this post when it is measured.
Regional servers
The same night, three regional Dedicated servers that had sat idle were set to switch off when nobody is playing in their region, and to start again when someone there joins. Until a server is back up, that first player plays on the nearest running server.