vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=255673

Delay reindexing as necessary to control server load
by Philip
22 Dec 2010 02:45

It is sometimes necessary to rebuild the search index, and it can be quite resource-intensive and time-consuming with larger boards. It takes a few hours on my forums, so I just came up with the following code to keep the server load from spinning out of cotrol. It should work under most linux distributions, as long as you have access to /proc/loadavg from PHP (if not, see notes below).

In /admincp/misc.php, find the following lines (around line 184 in the latest vB 4.1 PL1 build):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Right after, add this code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


The idea is that this only adds a delay to redirects when/if server load exceeds some value (8 in this example).
The only downside I can see is checking the load average after each redirect... But it seems to work much better than the default reindexing on my server.


I hope it helps someone.


Notes:
If you do not have access to /proc/loadavg from PHP, you can try to execute `uptime` instead, or just add the "usleep ..." line to delay each redirect (even though it's a crude solution as it would slow down reindexing by a lot regardless of server load).

The uptime code variant of the above should be something like:
$load = explode(' ', `uptime`)
$load_5min = $load[count($load)-1];
if ($load_5min > 8) { .....

abualjori 23 Dec 2010 23:48

Thank you so much for sharing.:)

will test it out this morning.


the same line of code could be found in line 167 for vb3.

KProjects 06 Apr 2011 20:47

Good idea

Zachery 06 Apr 2011 22:09

I'd just switch to sphinx


All times are GMT. The time now is 22:56.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.