One player told me the homepage was slow. It was taking 25 seconds.
A player mentioned the front page felt sluggish. I measured it, and then I measured it again because the first number looked like a mistake: almost 25 seconds before the server returned anything. That kicked off two days under the hood — and turned up something considerably worse than a slow page.
⚡ Twenty-five seconds to open one page
- The cause was not subtle. The homepage recalculated every league-wide statistic from scratch on every single visit, for every visitor, over and over.
- With a handful of save games that was invisible. Every new save game made the sum a little bigger, and it kept growing until it added up to half a minute of waiting.
- Those figures are now worked out once instead of on every request. The homepage answers in a fraction of a second.
🔍 The part that bothers me more than the wait
- That page had almost certainly been broken for weeks. Exactly one person mentioned it.
- That is how it goes: people report crashes, but when something is merely slow they close the tab and do not come back. There is no bug report for that.
- So there is now automatic monitoring. The game times itself and tells me when a page takes too long, whether or not anybody complains.
🧹 Six million rows that should not exist
- Cleaning up the database turned up more than six million rows belonging to save games that were deleted long ago.
- The reason was a bug of mine, and not a small one. Deleting a save game cleared 19 of the 28 tables that hold its data. The one it skipped happened to be the largest: per-match player statistics.
- So every deleted save left its full match history behind — and because the save itself was then gone, the nightly clean-up could never find those leftovers again either.
🗄️ What changed
- The delete now reads the table list from the database itself instead of following a list I have to remember to update. It cannot fall behind again.
- The nightly routine also sweeps up old leftovers now — data whose save game no longer exists.
- The largest table dropped from roughly 20 million rows to about 9 million, and around 1.8 GB went back to the server.
- You will notice this indirectly more than directly: a smaller database is a faster one.
Two days of work and not one new thing to click — and still the best-spent time in a while. If a page feels slow on your end, do tell me. The game catches a lot on its own now, but nowhere near everything.