[2]: I've been slowly moving database queries to a simple cache object I created that refreshes each cache item at some arbitrary interval in the background (source). That way cache reads are always instant. By caching the homepage's list of categories, forums, and latest posters (updated every 10 seconds), I reduced the homepage load time from 20-50ms to <1ms on localhost.
I'm laughing so hard when reading this post. It's nothing you said (well, no, it's everything you said), it's just that...
After you posted
this, I started brainstorming with a friend of mine via instant messenger. My thoughts were:
Me: okay, so I'm curious about something
Me: in a normal forum, when you load a page (like the main index) it tells you how many posts are in a particular forum, or other such statistics
Me: behind the scenes, every time you load the page, the database is being queried for this data and grabbing its most current numbers
Me: so here's my curiosity
Me: what would happen if, during, say, the act of posting a new topic, the forum simultaneously updated the database and queried the new statistic for that post
Me: then recorded it on a flat file with just basic stats
Me: then page loads would pull from that file rather than the db
Me: would the cheaper costs to the database outweigh the potential problems (deadlocking, overwrites, page loading errors, etc)?
Friend: dunno
Me: 'twould be interesting to experiment if it hasn't already been tried
Me: I'm thinking like the basic stats
Me: like stuff on the main page of the forum, which is loaded most frequently
Me: so basic post counts for indidvidual boardstotal member numbers
Me: stuff that doesn't need to be updated by the second
As you can see, my friend was
extremely helpful with this brainstorm. It went nowhere. But now I see you effectively doing the same thing. And it makes me happy,
@Mahz.