Quote:
Originally posted by Ritsui
How about scaling dynamically with load? Something like:
PHP Code:
$loadMult = (($loadavg[0] * 100) +5); //change these values to tweak frequency of writes
if ( mt_rand(1,$loadMult)=='1' ) {
...snip...
This would seem to work better at least with smaller forums that have occasional very heavy peaks where you still want views to be updated frequently, but less based proportionally on load.
|
Sure, this would work. But personally, I don't want it doing any updates when the load is high. I don't mind losing views if the server crashes.
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.