Advertisement:

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

Offline Ben_S

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,702
  • xxx
Disabling resource intensive features based on server load
« on: March 14, 2006, 04:33:04 PM »
SMF 1.1 introduces a new feature.

This new feature can be used to disable certain other features that can be hard on the server depending upon the server load.

Note, it is not recommended that you use these options if you are on a shared server as other users load will affect your board and you may find it being disabled when it doesn’t need to be.

There is no admin interface for this feature to prevent people enabling the feature and locking themselves out of their forum.  You will need to enable it with phpMyAdmin (What is phpMyAdmin?).  This way you can just go back to phpMyAdmin and undo the changes.

To enable it, run the following query (you may with to adjust the values before hand)

Code: [Select]
REPLACE INTO smf_settings
   (variable, value)
VALUES ('loadavg_enable', '1'),
   ('loadavg_forum', '40.0'),
   ('loadavg_auto_opt', '1.0'),
   ('loadavg_search', '2.5'),
   ('loadavg_allunread', '2.0'),
   ('loadavg_unreadreplies', '3.5'),
   ('loadavg_show_posts', '2.0');

This will disable the forum completely if the server load is above 40, automatic database table optimization with a load above 1, search with a load above 2.5, users “show all unread posts” at 2, users “show all unread replies” at 3.5 and the profile > show users posts at a load of 2.

If you need to tweak any of the settings, you can just do a REPLACE INTO, e.g. to turn the feature off, you can run

Code: [Select]
REPLACE INTO smf_settings
   (variable, value)
VALUES ('loadavg_enable', '0');
« Last Edit: March 14, 2006, 06:00:32 PM by Amacythe »
Liverpool FC Forum with 14 million+ posts.

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,361
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Disabling resource intensive Features based on server load
« Reply #1 on: March 14, 2006, 04:35:16 PM »
Sweeet!! Cant' wait till SMF 1.1. This is going to rock!
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline ediww

  • Semi-Newbie
  • *
  • Posts: 95
  • Gender: Male
    • Форуми към БГ-Мамма
Re: Disabling resource intensive features based on server load
« Reply #2 on: September 09, 2006, 08:14:18 AM »
hi there, are the dots in the values required at all?
Beep-beep-beep. Beep-woop-woo. Beep-boop.

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,361
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Disabling resource intensive features based on server load
« Reply #3 on: September 09, 2006, 09:17:08 AM »
The dot's aren't required mainly there if you want to get to an exact limit
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline qtime

  • Full Member
  • ***
  • Posts: 501
Re: Disabling resource intensive features based on server load
« Reply #4 on: February 25, 2007, 05:50:54 PM »
Is it possible to set different values according certain membergroups?

Offline Ben_S

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,702
  • xxx
Re: Disabling resource intensive features based on server load
« Reply #5 on: February 25, 2007, 07:50:59 PM »
No
Liverpool FC Forum with 14 million+ posts.

Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 874
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #6 on: October 11, 2007, 06:56:44 AM »
Code: [Select]
REPLACE INTO smf_settings
   (variable, value)
VALUES ('loadavg_enable', '1'),
   ('loadavg_forum', '40.0'),
   ('loadavg_auto_opt', '1.0'),
   ('loadavg_search', '2.5'),
   ('loadavg_allunread', '2.0'),
   ('loadavg_unreadreplies', '3.5'),
   ('loadavg_show_posts', '2.0');

This will disable the forum completely if the server load is above 40, automatic database table optimization with a load above 1, search with a load above 2.5, users “show all unread posts” at 2, users “show all unread replies” at 3.5 and the profile > show users posts at a load of 2.

Discussion around this feature (which I was completely unaware of) has come up again in the MODs forum again and I would just like to ask:

1. The feature "Disable Forum" means that forum goes to Maintenance Mode?

2. Does anyone know the "best" tweaking values for each option? I'm not familiar with server load values, so I really don't know if values should be tweaked according to server-type, to forum size, to forum bandwidth, or if any other parameter should be taken into account.

Offline Ben_S

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,702
  • xxx
Re: Disabling resource intensive features based on server load
« Reply #7 on: October 11, 2007, 07:38:02 AM »
1. Not Maintenance Mode, it uses a fatal error message (as far as I remember) to show the server load is currently too high, all access will be denied including admins.

2. There are no best values, they are entirely dependent upon the server you are on, if you are not on a dedicated server, I'd suggest you don't even bother with this feature since 90% of the time, the load will not be caused by your forum.
Liverpool FC Forum with 14 million+ posts.

Offline Paracelsus

  • Sr. Member
  • ****
  • Posts: 874
  • Gender: Male
Re: Disabling resource intensive features based on server load
« Reply #8 on: October 11, 2007, 09:55:39 AM »
Tkx ;).

I just wondered if I should get worried with that.
Our forum, which consumes about 50 Gb bandwidth / month, had 1Gb disk space to use - 250 Mb for MySQL database and 410 Mb free space - and it crashed twice because of not enough disk space to execute those "temporary" MySQL table operations... but now it was upgraded to 5Gb and everything is smooth now.

But it's surely too small yet to cause any server load... ;D

Offline Col

  • Sr. Member
  • ****
  • Posts: 964
Re: Disabling resource intensive features based on server load
« Reply #9 on: October 13, 2007, 10:11:38 PM »
Hi Ben,

I understand that this should not be used in shared server environment, but what if the server has mod_perl2 installed? This enables resources to be assigned to individual accounts - might it be possible to use the individually assigned resource levels so that peoples' forums aren't being disabled because of a high total server load?

Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,022
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Disabling resource intensive features based on server load
« Reply #10 on: October 14, 2007, 06:00:35 PM »
mod_perl doesn't have anything to do with resource assignment, it is merely a way to run perl scripts inside the Apache process instead of as a CGI.
Motoko-chan
Director, Simple Machines

Just because it's pouring down doesn't mean we're gonna drown. There's a time when all you can say is let it rain - Mat Kearney (Let It Rain)

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


Offline se7o.com

  • Sophist Member
  • *****
  • Posts: 1,070
Re: Disabling resource intensive features based on server load
« Reply #11 on: November 07, 2009, 03:32:22 PM »
it show this error

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'loadavg_forum', '7.0'' at line 1

Offline Kill Em All

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,144
  • Gender: Male
  • Something has to go wrong. Just has to.
    • KEAGaming
Re: Disabling resource intensive features based on server load
« Reply #12 on: February 07, 2010, 09:59:32 PM »
se7o.com, this post is quite old, MySQL probably had revisions and the code has probably changed, that is why it probably wont work.
My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Offline Something like that

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,496
  • Gender: Male
  • ]
Re: Disabling resource intensive features based on server load
« Reply #13 on: February 08, 2010, 10:28:05 AM »
se7o.com, this post is quite old, MySQL probably had revisions and the code has probably changed, that is why it probably wont work.

That's standard SQL that's been around for decades. It's possible that he copied and pasted incorrectly.

Offline Ricky.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,056
    • Indian Linux Forums
Re: Disabling resource intensive features based on server load
« Reply #14 on: December 31, 2010, 02:22:43 AM »
I know this post is quite old but its very helpful as it saves your forum if there is sudden spike or something. However, is there way to customize message it shows and also to not to lock down forum for Admin?

Offline Aleksi "Lex" Kilpinen

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,430
  • Gender: Male
  • The Artist Formerly Known as LexArma
Re: Disabling resource intensive features based on server load
« Reply #15 on: December 31, 2010, 02:27:33 AM »
You can probably customize the message somehow, can't remember how this worked on 1.1 - but you can not make it so that it would care about your membergroup.
Finnish Support Local Moderator & Support Specialist
My Mods: Facebook and Twitter Sharer



Offline Ricky.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,056
    • Indian Linux Forums
Re: Disabling resource intensive features based on server load
« Reply #16 on: December 31, 2010, 09:42:47 AM »
Ok, which part or what files deal with this settings.. .. that way I can look into myself !

Offline Dzonny

  • Lead Localizer
  • SMF Super Hero
  • *
  • Posts: 11,617
  • 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 #17 on: January 01, 2011, 01:00:44 PM »
This is really work?
It would be very helpflu to have somthing like this in admin panel.
Quote
This will disable the forum completely if the server load is above 40, automatic database table optimization with a load above 1, search with a load above 2.5, users “show all unread posts” at 2, users “show all unread replies” at 3.5 and the profile > show users posts at a load of 2.
by "server load above 40", u mean if server ram memmory is above 40% or what? :D

Offline qtime

  • Full Member
  • ***
  • Posts: 501
Re: Disabling resource intensive features based on server load
« Reply #18 on: January 01, 2011, 01:06:39 PM »
This is really work?
It would be very helpflu to have somthing like this in admin panel.
Quote
This will disable the forum completely if the server load is above 40, automatic database table optimization with a load above 1, search with a load above 2.5, users “show all unread posts” at 2, users “show all unread replies” at 3.5 and the profile > show users posts at a load of 2.
by "server load above 40", u mean if server ram memmory is above 40% or what? :D
please check this http://www.lifeaftercoffee.com/2006/03/13/unix-load-averages-explained/ to find out.

Offline Dzonny

  • Lead Localizer
  • SMF Super Hero
  • *
  • Posts: 11,617
  • 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 #19 on: January 01, 2011, 01:12:49 PM »
Right, thank you, just read that, and get it :) I didnt know about that, couse i just moved from share to vps server.
So, anyone is using this on public forum? Is it working? Can it work with 1.1.12 version? :)