The Arcive of vBulletin Modifications Site. |
|
Disabling search during heavy loads Details »»
|
|||||||||||||||||||||||||
From 3pm-6pm every day I get a very high level of traffic that sends my server load into the 40s (unless I use the server load limit, which then gives alot of people th busy message). With about 750 or so people online, one of the issues appears to be use of the SEARCH feature which locks a table and starts a backup of requests. So, I added some additional code to search.php:
Code:
// server too busy?
$toobusy = false;
if (@file_exists('/proc/loadavg') AND $filestuff = @file_get_contents('/proc/loadavg'))
{
$loadavg = explode(' ', $filestuff);
if (trim($loadavg[0]) > 20)
{
$toobusy = true;
}
}
if ( !$vboptions['enablesearches'] || $toobusy )
{
eval(print_standard_error('error_searchdisabled'));
}
Thought someone else might find this useful (you can change the 20 varibale to suit your needs). PS: I finally configured my server with both Apache and thttpd running and once DNS is updated, I'm going to offload my images onto the thttpd setup to see how that helps with overall loads. Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
Nice, thanks for sharing, I konw I will use it one day when my website becomes big
|
|
#3
|
|||
|
|||
|
Hopefully my site becomes big enough i can use this
|
|
#4
|
|||
|
|||
|
thanks, very usefull for peaktimes!!
|
|
#5
|
|||
|
|||
|
Great, Can you kindly add a field on the setting section to control the load from there, just like the "NIX Server Load Limit" option.
Thanks |
|
#6
|
||||
|
||||
|
After running for a few days this appears to be having a positive effect on keeping my load in check - and those pesky "server too busy" messages are a thing of the past.
I also offloaded the images onto another domain which I am running thttpd on (on the same server as apache); this appears to be having a dramatic effect during peak times where 700+ users are online - my server load is half what it was before offloading and using this mod and my page generation times have been cut in half. |
|
#7
|
|||
|
|||
|
Where in search.php does this go?
|
|
#8
|
||||
|
||||
|
Look for the code that is not in bold and add it to that part.
|
|
#9
|
|||
|
|||
|
Thank you kindly. I had this for ver 2 and it worked great! This should be part of VB all together.
|
![]() |
|
|