Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 1268
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Shoutbox (Heavy Load)

Started by Cermno1981, February 03, 2011, 06:49:52 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Cermno1981

Hello,

My web host has requested that I disable my shoutbox (by requested, I mean told!) due to the heavy load this was creating on the server. I had the shoutbox configured as follows;

Shouts to display - 50
Max shouts - 1000
Caching enabled
Autorefresh enabled

My question is, is there a way to reduce the server load? I considered disabling the autorefresh feature, but I am unsure what this will actually achieve. When a user loads the page (and shoutbox) for the first time, what kind of load will this create?

I am running SMF 2.0 RC4 with SP 2.3.3.

I am naturally eager to not have my hosting package disabled completely.

If there are suitable hosts out there who are more supporting, I would be interested in knowing who they are.

Thanks

C

Nathaniel

Disable the autorefresh, that causes the biggest load. As every user viewing your site will make a request every x seconds, to get an update on the shoutbox.

Also consider disabling some of the bbc tags (if you have any enabled).
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

keith021773

also disable the shoutbox for guests.   Use it just for members and that will reduce your load drastically if you have a lot of guests.

AngelinaBelle

Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Cermno1981

We had to remove SP completely. My host took a hard line and said the presence of the script was a risk.

So.... I've arranged to move to a host who says I can use it. I just cannot cope with the TP shoutbox or portal, it's utter crud in comparison.

Thank you for the help though, if we experience issues again I'll be making the suggested changes. :)

AngelinaBelle

OK. The shoutbox can introduce a heavy load, though SimplePortal without shoutbox should not be too bad.  If you have trouble on the new host, we'll be here.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Cermno1981

I changed host and have reinstated the SP shoutbox. The new host is far more obliging!

Again, thank you very much for your help. This is what will keep people coming back. :)

P.S. Do you take donations towards running costs?

AngelinaBelle

Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Cermno1981

Will set something up. :nervous-happy:

Onto topic...

The new host is watching resource usage carefully, and we don't want to disable the auto refresh (it's just such a great feature), so.... is there a way to have the shoutbox deactivate itself after 'X' minutes of inactivity? Inactivity could be the last time you navigated the site or typed into the shoutbox.

I know of a VB shoutbox that does this.

Thanks

Cermno1981

Google is my friend, it seems this has been asked for before.

http://simpleportal.net/index.php?topic=3681.msg23387#msg23387

If I follow the link within, it seems this has already been done for 2.4. This is great news!

Now this might be a tall order, but is there any chance of a way to do it now before my new host goes grey with stress?  :)

AngelinaBelle

I do not know the code to disable refresh on an inactive shoutbox.
For now, I suggest two things:
1) Make the refresh time-out longer
2) Disable most of the BBC permitted in the shoutbox.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Cermno1981

I'll need to find a more permanent solution I think, my host sent me usage and resource information and we're literally crippling the server.

SP is not only the best portal, but the best shoutbox too. I'll see what I can cook up.

Cermno1981

We've now increased the refresh to 20 seconds, and are seeing how that goes. My gut feeling is that 20 seconds is too long.

I may be asking for the impossible here, but would there be any chance of a hotfix? I understand if not, you don't want to be supporting different code bases.

Cermno1981

I'm not into shameless bumps, but I just wondered if there might be any possibility of getting my current shoutbox to deactivate as per the 2.4 version.

Thanks in advance.

Cermno1981

I think I solved this...

if (!empty($shoutbox['refresh']))
echo '
var counter = 0
interval_id_', $shoutbox['id'], ' = setInterval( "sp_auto_refresh_', $shoutbox['id'], '()", ', $shoutbox['refresh'], ' * 1000);


function sp_auto_refresh_', $shoutbox['id'], '()
{
       
if (window.XMLHttpRequest)
{
sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], ');
}
else
clearInterval(interval_id_', $shoutbox['id'], ');

counter++;

if ( counter > 30 )
{
             
clearInterval(interval_id_', $shoutbox['id'], ');
        }
}';


Before tonight I had no experience in Java whatsoever, so if this is a valid fix then I am well chuffed! :nervous-happy: (is it??)

I declared a variable 'counter' as a default value of 0, and then increment this value on each refresh. I hard coded (as a test) a limit of 30, at which point it clears the refresh interval and ends the heavy load on the server.

Please can somebody validate? I am not a programmer, this is the result of many tutorials read over 2 hours.

Thanks!!

AngelinaBelle

This seems like a step in the right direction.

You can try this out on a "test" forum to see if it behaves as required (stops refreshing after the count interval).
I will let the team know you are customizing your own workaround.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Cermno1981

Thanks Angelina

I've tested it on my home laptop with runs Ubuntu with Apache. I had both me and a friend spam the forum (me locally, him remotely) with 80+ sessions between us. After the counter hit 30, the usage dropped.

I guess as a newbie, I was looking for an assurance that my code was sound.

P.S. Thanks for taking the time to look at it :)

AngelinaBelle

(I didn't really take a look at it.  I didn't test it at all).
I'm glad you figured this out. Please let us know how this works on your production forum!
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Cermno1981

This is in testing at the moment. I have to say, it feels a lot faster already.

Indications early on are good!