So now, what is a conuery?
Database access with our web hosts is measured in
Conueriesis a term we at DreamHost came up with to measure MySQL database usage. The word is a combination ofconnectionsandqueries, as that is what the unit is derived from! Basically, the number of MySQL queries you have in a month, plus 25 times the number of connections you have is your totalconueriesfor a month!
Trouble is, if we go over a certain amount per month, we get charged extra. Which is bad, especially when you're running a free game (amazingly, bandwidth is not a problem for us yet since we're
only sending about 100MB of data per day).
We're already using persistent connections which reduces the number of database connections (the things worth 25x a query) that we make, by a very large amount. Now the problem is purely the number of database queries.
JOINs wherever possible (ie. a lot) to reduce the number of queries needed and to improve general efficiency of the code, but it's not enough.
The reason for the large increase is almost certainly due to the rapid increase in the number of players that we had recently (until the game reached maximum capacity of 90). The main problem lies in the ticker. The ticker is a piece of code that executes once every 3 minutes and performs all actions in the game (executing ship orders, calculating resources mined/spent, increasing populations, calculating combat). It has been optimised in the past, but it would seem that it needs more work.
Not to worry though, we've spotted some places where we can improve things and GwieF will soon have it running much more efficiently for us (well we can't all work on it at once ;)). If it becomes necessary though, we may have to decrease the speed of the ticker (eg. make it once every 6 minutes). That wouldn't exactly be the end of the world.