Advertisement:

Author Topic: Disabling resource intensive features based on server load  (Read 48514 times)

Offline qtime

  • Full Member
  • ***
  • Posts: 501
Re: Disabling resource intensive features based on server load
« Reply #20 on: January 01, 2011, 01:16:26 PM »
yes it's working at 1.1.2

don't be afraid if your serverload is 10 and your forum is fast.

Offline Dzonny

  • Localizer
  • SMF Super Hero
  • *
  • Posts: 11,923
  • Gender: Male
  • No sleep...
    • dzontra.nikola on Facebook
    • Dzonny on GitHub
    • dzontranikola on LinkedIn
    • @opusteniforum on Twitter
    • Samo opusteno
Re: Disabling resource intensive features based on server load
« Reply #21 on: January 01, 2011, 01:37:17 PM »
yes it's working at 1.1.2
U mean 1.1.12?  :D

don't be afraid if your serverload is 10 and your forum is fast.
Serverload is currently below 1.5 for each 5, 10 and 15min. As i can get, it is fine, right?

Offline qtime

  • Full Member
  • ***
  • Posts: 501
Re: Disabling resource intensive features based on server load
« Reply #22 on: January 01, 2011, 01:42:58 PM »
yes working at 1.1.2 and serverload is very nice.
To protect overloading of the server, you could setup search to 5 for example. If the server is higher loaded, it will avoid searching and serverload could drop.

Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,068
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Disabling resource intensive features based on server load
« Reply #23 on: January 01, 2011, 01:48:17 PM »
This is really work?
It would be very helpflu to have somthing like this in admin panel.

Bad idea. Most users would be somewhat clueless on the settings and could easily enter them in low enough that they would effectively shut down their forum. The only way to recover would be to edit the settings directly in the database. Someone who didn't know enough to use the settings correctly would likely not know how to make the necessary database edits to fix the damage.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Offline Dzonny

  • Localizer
  • SMF Super Hero
  • *
  • Posts: 11,923
  • Gender: Male
  • No sleep...
    • dzontra.nikola on Facebook
    • Dzonny on GitHub
    • dzontranikola on LinkedIn
    • @opusteniforum on Twitter
    • Samo opusteno
Re: Disabling resource intensive features based on server load
« Reply #24 on: January 01, 2011, 01:51:08 PM »
Hm right, but i just have my own forum on vps, and dont plan any clients there for now.

Online Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,541
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Disabling resource intensive features based on server load
« Reply #25 on: January 01, 2011, 02:15:50 PM »
Actually, 2.0 has this built into the Admin CP, as part of the server settings... ::)
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,068
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Disabling resource intensive features based on server load
« Reply #26 on: January 01, 2011, 04:11:52 PM »
Actually, 2.0 has this built into the Admin CP, as part of the server settings... ::)

Indeed it does (Configuration -> Server Settings -> Load Balancing), albeit with a red warning. I recall a push to get many of the "hidden" settings added to the UI.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Offline Dzonny

  • Localizer
  • SMF Super Hero
  • *
  • Posts: 11,923
  • Gender: Male
  • No sleep...
    • dzontra.nikola on Facebook
    • Dzonny on GitHub
    • dzontranikola on LinkedIn
    • @opusteniforum on Twitter
    • Samo opusteno
Re: Disabling resource intensive features based on server load
« Reply #27 on: January 01, 2011, 06:33:57 PM »
Hm, ok, is it the same system as posted here in the first post?
Im using 1.1.12, and i will try it to see if its working.
« Last Edit: July 18, 2011, 12:11:52 PM by Dzonny »

Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,068
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Disabling resource intensive features based on server load
« Reply #28 on: January 01, 2011, 09:57:51 PM »
Hm, ok, is it the same system as postet here in forst post?
Im using 1.1.12, and i will try it to see if its working.

Yes. Be careful, you can make your forum unusable.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 876
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #29 on: July 18, 2011, 11:42:40 AM »
Sorry to push this old thread up, but I want to use this to disable the feature that allows guests to browse the forum abobe a certain load. Would it be possible to do it and if so what is the parameter/function?

Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,068
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Disabling resource intensive features based on server load
« Reply #30 on: July 18, 2011, 11:56:44 AM »
As far as I know, that is not currently an option. The load options allow one to disable certain high-load-causing features, but browsing is not one.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Disabling resource intensive features based on server load
« Reply #31 on: July 18, 2011, 05:45:58 PM »
In 2.0 the threasholds are:
Threshold to disabling automatic database optimization
Threshold to disabling search
Threshold to disabling all unread topics
Threshold to disabling unread replies
Threshold to disabling showing user posts
Threshold to disabling the forum completely
Details: Load Balancing.

The last one seems what Paracelsus is looking for, but it affects all the users, not only guests.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,068
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Disabling resource intensive features based on server load
« Reply #32 on: July 18, 2011, 06:10:06 PM »
Threshold to disabling the forum completely
Details: Load Balancing.

The last one seems what Paracelsus is looking for, but it affects all the users, not only guests.

Exactly. That one shouldn't be used as a default. It effectively does the same thing as setting maintenance mode to 2, which makes the forum inaccessible to everyone, even admins.

Potentially, the system could be extended to allow this, but I'm not sure how big a benefit would be provided since you'd still have to allow logins, which would increase load anyway.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 876
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #33 on: July 19, 2011, 01:48:52 AM »
Well, since we are dedicated to a sports, mainly football (soccer) club, the loads tend to peak in specific periods, ie, during the club's football matches. In our experience, disabling browsing to guests in these couple of hours allows the forum to become much more responsive and faster than without this option.

Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 876
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #34 on: July 19, 2011, 02:37:25 AM »
The only function I can find on smf_settings.php that might do the trick is this one: allow_guestAccess, but Subs-Auth has the KickGuest function also.

Could this actually work?
Code: [Select]
REPLACE INTO smf_settings
   (variable, value)
VALUES ('loadavg_enable', '1'),
   ('loadavg_allow_guestAccess', '40.0');

Subs-Auth.php has this piece of code:
Code: [Select]
// Kick out a guest when guest access is off...
function KickGuest()
{
global $txt, $context;

loadLanguage('Login');
loadTemplate('Login');

$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];

$context['sub_template'] = 'kick_guest';
$context['page_title'] = $txt[34];
}

Would it make sense to be like this:
Code: [Select]
REPLACE INTO smf_settings
   (variable, value)
VALUES ('loadavg_enable', '1'),
   ('loadavg_KickGuest', '40.0');

Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 876
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #35 on: July 19, 2011, 03:12:53 AM »
Ok, maybe the above isn't such a good solution after all...

What about this one: install this MOD - High Server Load Warning (http://custom.simplemachines.org/mods/index.php?mod=2699) and then on index.template.php replace this:

Code: [Select]
$load = sys_getloadavg();
if ($load[0] > $modSettings['amount_server_load_check'] && !empty($modSettings['enable_server_load_check'])) {
    echo '<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/hslw.js"></script>

<div id="topbar">
<table width="100%">
<tr>
<td width="99%">
', $txt['text_server_load_check'], '&nbsp;&nbsp;&nbsp; </td><td width="1%"><a onclick="closebar(); return false"><img style="float: left" src="', $settings['images_url'], '/icons/hslw-close.gif" border="0"></a>

</td>
</tr>
</table>
</div>';
}

with something like this:
Code: [Select]
$load = sys_getloadavg();
if ($load[0] > $modSettings['amount_server_load_check'] && !empty($modSettings['enable_server_load_check']))
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}

 ???

Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 876
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #36 on: July 28, 2011, 05:46:21 AM »
So, in the end, it was even easier and simpler. This worked for me:

Put somewhere in Index.php between the if's this piece (I've put after the line "// Is the forum in maintenance mode?"):
Code: [Select]
$load = sys_getloadavg();
in Index.php turn this:
Code: [Select]
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', 'verificationcode'))))
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}

into this (the load 15 is just an example that can be adjusted to whatever value people want to):
Code: [Select]
// If guest access is off, a guest can only do one of the very few following actions.
elseif ((empty($modSettings['allow_guestAccess']) || ($load[0] > 15)) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', 'verificationcode'))))
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}

Offline humbleworld

  • Sr. Member
  • ****
  • Posts: 886
    • best article
Re: Disabling resource intensive features based on server load
« Reply #37 on: January 28, 2013, 11:07:50 PM »
Can I use this option for our VPS? Memory is 1.2 GB. Bandwidth is 3,500GB. Space is 60GB.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,397
    • StoryBB/StoryBB on GitHub
Re: Disabling resource intensive features based on server load
« Reply #38 on: January 28, 2013, 11:13:08 PM »
...it's built into SMF since 1.1 and even has the Load Balancing page in the admin panel since 2.0 RC2...
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.