Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Disabling search during heavy loads Details »»
Disabling search during heavy loads
Version: 1.00, by MPDev MPDev is offline
Developer Last Online: Dec 2016 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 05-09-2005 Last Update: Never Installs: 8
 
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 05-10-2005, 06:15 PM
Polo's Avatar
Polo Polo is offline
 
Join Date: Jun 2004
Posts: 893
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice, thanks for sharing, I konw I will use it one day when my website becomes big
Reply With Quote
  #3  
Old 05-10-2005, 06:35 PM
FightRice.com FightRice.com is offline
 
Join Date: Mar 2005
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hopefully my site becomes big enough i can use this
Reply With Quote
  #4  
Old 05-10-2005, 11:03 PM
Nordinho Nordinho is offline
 
Join Date: Aug 2004
Location: Netherlands
Posts: 288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks, very usefull for peaktimes!!
Reply With Quote
  #5  
Old 05-10-2005, 11:12 PM
Remi Remi is offline
 
Join Date: Nov 2001
Location: London, UK
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 05-11-2005, 01:40 AM
MPDev's Avatar
MPDev MPDev is offline
 
Join Date: Oct 2003
Location: Virginia
Posts: 885
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 05-11-2005, 02:24 AM
greenhybrid greenhybrid is offline
 
Join Date: Jan 2005
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where in search.php does this go?
Reply With Quote
  #8  
Old 05-11-2005, 12:34 PM
MPDev's Avatar
MPDev MPDev is offline
 
Join Date: Oct 2003
Location: Virginia
Posts: 885
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look for the code that is not in bold and add it to that part.
Reply With Quote
  #9  
Old 05-25-2005, 01:59 PM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:53 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04647 seconds
  • Memory Usage 2,273KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete