![]() |
Delay reindexing as necessary to control server load
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): Code:
if ($vbulletin->GPC['autoredirect'] == 1) Code:
$load = explode(' ',@file_get_contents('/proc/loadavg')); // find out load 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) { ..... |
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. |
Good idea
|
I'd just switch to sphinx
|
All times are GMT. The time now is 05:51 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|