In the next WarLight release (1.08), games that have been finished for more than 10 days will be archived. For the most part, this doesn’t change anything — archived games are still available in your My Games page just like they were before and you can still read all of the chat and view all of their history. This is just a change to the way WarLight stores finished games internally, so if you’re not interested in learning how WarLight works behind the scenes you can stop reading now.
The WarLight database
Today, WarLight is powered by a single PostgreSQL database that houses all games, chat, history, etc. I’m a huge fan of Postgres, and it’s worked very well for WarLight. However, being a relational database, there are limits to how far you can scale. Currently, the WarLight database is closing in on 30 gigabytes, and anyone who’s ever worked with big relational databases knows that it’s no fun. (ever tried to add a new column to a many-GB table? While ALTER TABLE is running, your site is down!)
One option to alleviate this is to delete old games. While some games certainly could be deleted without much of a fuss (those that got voted-to-end or real-time games), in general I really enjoy taking trips down memory lane and looking up old games. I think keeping games around is a really fun feature, so this isn’t my favorite option.
Instead, I set out to design a system that will allow WarLight to grow without needing to delete games. Postgres works great while games are in progress and queried and updated frequently, however WarLight can’t just be backed by a single monolithic database forever.
Enter the Archive Database
When games have been finished for more than 10 days, the archiver will remove it from the main Postgres database, compresses it and store it in the archive database, which is powered by MongoDB. Mongo is great for an archive, since it allows for changing your schema without needing downtime.
I said above that this change mostly won’t impact players. However, there are a few small changes:
- You can’t chat in archived games. Remember games aren’t archived until 10 days after they’re complete, so that should be plenty of time to say your ggs and do any post-game discussion. All of the game’s chat is still available to read, you just can’t say anything new.
- If a game still has unread chat when it’s archived, it won’t show up as having unread chat on the My Games page. The chat is still available if you open the game, it’s just not shown on the My Games page. Hopefully players who go 10 days without reading the chat aren’t likely to ever read the chat anyway.
- The default filter on the My Games page is changing from All Games to Active Games. If you really want your default to be All Games again, feel free to change it back. The reason it’s changing is just because the All Games query is getting more expensive to run since it has to query the archive, and most of the time players really just want to see their active games anyway.
Hopefully these aren’t too big of a deal for anyone. At some point in the future, expect a policy on abandoned in-progress games so they can be archived, too.
I’m currently finishing up the 1.08 release which has the archive system and a few improvements that will be announced soon. Once that’s done, there are two things on my mind:
1. New ladders! Due to the influx of new members lately, hopefully we can support one or two new ladders. Look for a poll soon on what ladder types you’d join.
2. Resume work on the iPhone and Android versions of WarLight. I hope to get the Android version caught up to the iPhone version so that it can be released to members for early testing. Android is nice in that there’s no limit to how many testers you can have, unlike the iPhone version which has to be restricted to a select audience.