PDA

View Full Version : Stats and Online Users modules caching a possibility?


Spinball
11-06-2007, 04:49 AM
Hello,
I would like to propose modifying these modules to allow caching of them every couple of minutes.
They are quite resource hungry and with people hitting the home page every second, there is quite a drain on the MySQL server.
Would this be possible?

Brian
11-06-2007, 09:46 AM
The stats module really shouldn't use too many resources at all. It just uses one query to get the counts from your 'forum' table, and one more to grab the info for the top poster. Granted it wouldn't hurt to cache those two queries, and I'll see if I can get that worked into the next release, but I don't think it's going to make a huge difference.
I did notice that you've removed the top poster from the stats module though, so you may want to double check your settings for it and make sure that the 'Top Poster Update Frequency' option is set to something like 999999999. That should ensure that it's not still trying to grab the top poster often as that query can be more server intensive.

As for the online users, I don't think caching that would be very practical since you generally want to see who's online in real time. Since you don't seem to be listing the usernames though, you could probably remove a significant bit of coding from the online users module that should help at least a bit with performance.

If you're starting to have issues with the load and would like to submit a support ticket, I'll be glad to take a look at things for you and see if there's anything else I can suggest that would help out.

Our Sponsors
 

Spinball
11-21-2007, 05:49 PM
Many thanks, Brian.
I removed the top poster because it was always the same person and then our news robot (posting news and reviews from our sister site) shot into the top poster slot. That's when including the top poster became pointless. Yes the refresh frequency is set really high. It would be good to have the top poster as an option.

I don't list the online users because when it's over a few hundred (which is usually is), squeezing all those names into the relatively narrow column isn't really particularly aesthetically pleasing. And not all that useful, either.
I would certainly appreciate a note on how to tweak the module and an official option to switch off the list in future releases.

And I think it would be useful to cache the newest member even if it's only every couple of minutes. With over 200 people registering every day, it's one person every 2 or 3 minutes during the busier times.
Yet if lots of people are hitting the home page - over 18,000 a day during our busiest day - meaning over 15 queries a minute during busier times.
Doesn't sound like much on reflection but every little helps.

We had a significant problem with load until we switched to Sphinx searches and then the forum improved 1000% at a stroke.
I'm still working on improving performance, though.

Brian
11-24-2007, 10:39 AM
I would certainly appreciate a note on how to tweak the module and an official option to switch off the list in future releases.
If you look in your modules/onlineusers.php file for this line and either remove it or comment it out then that should prevent the usernames from being processed and save a bit of your resources.
$loggedinusers[$onlineusers['userid']] = $onlineusers;

And I think it would be useful to cache the newest member even if it's only every couple of minutes.
The newest member already is cached, as that's done for the vB homepage by default, so the CMPS just uses that same cache.