Update: NFS are willing to help with more resources, which is my preferred solution since I’d like to stick with them. I just need to make absolutely sure I’ve tuned all I can tune. I’ll do this over the next week or so, most likely there’ll be interruptions to the site and the update process as I restructure some of it.
My host for this site, and a few others - NearlyFreeSpeech - is pretty good. Paying for only what you use in both storage and bandwidth really keeps the costs down for hosting a bunch of micro sites. Apparently their distributed hosting setup can easily cater for much higher traffic sites, too, so long as the site’s structure itself can cope with it.
I seem to be hitting a bit of a performance brick-wall with them though. The nature of this TF2 site is that it stores and processes quite a chunk of statistical data, even though the resulting output in terms of traffic is not that large. Given a couple of servers of it’s own it would run without breaking a sweat, as the size of the database has yet to reach even 500 MB, with indexes accounting for about 20% of that space. But in the shared environment of NFS hosting, while their web nodes are distributed, there’s only one MySQL process per logical database, and their default configuration means it has fairly limited memory resources to use (for example, the key buffer size is only 16mb, and I’m not able to use InnoDB tables).
Some of the basic queries that compute numbers on-demand, although they only run once an hour or so and are cached thereafter, take anywhere from 1 to 10 seconds depending on how much memory paging the server is having to do - I assume. Whereas the same query on the same data will be more like 150ms when run on my desktop, which has an abundance of memory.
But, in all things, you get what you pay for, I just can’t afford to pay for much more at the moment.
The bandaid solution for this is what I’ll be working on next; to move some of those longer running queries, those that can’t be fixed simply through optimisation due to the server setup, into the update process so the numbers are generated in advance instead of on-demand. This doesn’t remove the problem of a long running query, it simply shifts it to a location where it’s effects will be reduced.
After I’m sure I’ve done all the optimising I can do, I’ll probably approach NFS and raise the issue with them, to see if there’s anything they can do. Failing that, I may have to put feelers out to some people I know, to see if I can get some higher-spec hosting in exchange for… positive karma? that’s a currency, right?