vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Disabling search during heavy loads (https://vborg.vbsupport.ru/showthread.php?t=81259)

MPDev 05-09-2005 10:00 PM

Disabling search during heavy loads
 
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'));
}

which will disable the search feature whenever my server load gets above 20. This is seperate from the load limit in the admin and doesn't stop people from using the site, just search. (I changed the searchdisbaled phrase to include a polite message taht search was unavailable during high levels of activity).

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.

Polo 05-10-2005 06:15 PM

Nice, thanks for sharing, I konw I will use it one day when my website becomes big ;)

FightRice.com 05-10-2005 06:35 PM

Hopefully my site becomes big enough i can use this

Nordinho 05-10-2005 11:03 PM

thanks, very usefull for peaktimes!!

Remi 05-10-2005 11:12 PM

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

MPDev 05-11-2005 01:40 AM

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.

greenhybrid 05-11-2005 02:24 AM

Where in search.php does this go?

MPDev 05-11-2005 12:34 PM

Look for the code that is not in bold and add it to that part.

David Bott 05-25-2005 01:59 PM

Thank you kindly. I had this for ver 2 and it worked great! This should be part of VB all together. ;)


All times are GMT. The time now is 06:29 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
  • Page Generation 0.01257 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete