Delayed Statistic Counters
Hi @all,
are there any plans to delay the update of Statistics like "Views" on Topics / Boards to relax the io on serverside during the busy times ?
Some other boards do this using a cron Job to minimize the write operation.
Re: Delayed Statistic Counters
Reply #2 –
It will update every time you go into that Message - only thing it will not update twice if you call it repeatedly without viewing another Thread in the meantime.
-
I don't know how the circuit breaker works, but in Topic.subs.php is no sign of any exceptions, it just make the update into the Database.
-
I don't know if this will be a problem for me. I delayed the View Update on my MyBB Board to avoid running into trouble if the load gets high. But MyBB is using a different Datastructure where i don't know if i can compare it to Elkarte. I think Elkarte is putting a bit more load onto the Server, but this is just guessing at the moment. I need to make a few Load Testings as soon as my Importer is ready.
btw: i don't won't to loose Counters - i just like to have the updates delayed.
Re: Delayed Statistic Counters
Reply #3 –
Where do you store them "in the meantime" waiting for the db update?
Re: Delayed Statistic Counters
Reply #4 –
memcached ? (i know may be lost on powerfailure and so on.)
MyBB is inserting it into a table and updates the stats only once in a hour.
Re: Delayed Statistic Counters
Reply #5 –
So it not really delaying the writing of the "counts" just the calculation of the stats? I'd have to look to see how often that occurs, it might be on stats page load, not sure.
For a really busy sight, there are certainly my.cnf changes that you would make, as well as MyISAM -> InnoDB changes in the default install as well.
Re: Delayed Statistic Counters
Reply #6 –
I thing we talk about different things.
i talk about elkarte_topics.views .
Re: Delayed Statistic Counters
Reply #10 –
What I was talking about is the view count on the topics. It updates every time you visit the topic in your session so long as you go to another topic. That doesn't really make sense to me unless there's a new post. I would keep a "last_view_time" in the session with an array of $topic => time(). Then have a threshold of 5 minutes (tunable) for how often you'd update the topic. It would check the last post time of the topic as well so if $last_view_time < $last_post_time ? increaseViewCounter().
INSERT is almost always faster than UPDATE. Appending to a file is a hell of a lot faster than finding that data point in the file and then changing the value. The biggest issue is that it has to lock the row to run the update. INSERT has no locks, even on MyISAM.
Unless you're running one of the largest forums, you really shouldn't be worried about this kind of stuff though. Take a bit of advice from me, who has spent my entire dev life trying to work on performance, reliability, and scalability, it's not worth it.
Re: Delayed Statistic Counters
Reply #14 –
Wait, are you running MyISAM?