![]() |
Code:
if ($loadavg[0]<1 && mt_rand(1,5)=='44'){ |
Quote:
|
How about scaling dynamically with load? Something like:
PHP Code:
|
Quote:
If you want more frequent updates, change the 44 to 1, then change the 5 to something higher. A limit of 5 would mean the views would be update once every 5 pageviews -- not much of a savings IMHO. :) |
Quote:
With your code, for example, the load could be 50 and it would still update (if the correct random number was produced). Hundreds of consecutive db writes when the load is at 50+ won't be a pretty sight. :) |
Quote:
|
The good news is that vB3 will have this built-in. :)
|
I like this hack but it has one quirk... late at night when not many people are on it doesn't update that often and people are asking why...
Would it be possible to code in a timer so that it would write every 5min or so? But also have the random number generation so that it will write properly during normal usage? |
How can i set this so that it updates every 500 threadviews, without any conditionals? The server load on the mysql server is not a factor...it is the php server load that is an issue and something in apc is not playing nicely with this hack. I would like to keep it, but would prefer being able to set a fixed # at which it will dump.
I have been trying to use this: PHP Code:
|
Here is a file to let you use a cron job to do it instead of in showthread, its more efficent in my opinion.
Open up the file and change the path to your config.php, upload now to your server, and then create a cron job. Cpanel users can do this in the Advanced section just type php /home/path/to/deffered_views.php and set it to run every 30mins |
All times are GMT. The time now is 08:02 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|