Load balancing: Workaround for maxconnections issue?

Started by minstrel, August 07, 2006, 01:24:32 PM

Previous topic - Next topic

minstrel

SMF Version: SMF 1.1 RC2
My host has a limit of 50K MySQL connections per hour which my forum is now running into.

I am told that I can get around this by creating additional users and having the forum switch among them on a random basis.

In settings.php, lines 40-41:

$db_user = 'username';
$db_passwd = 'password';


I need to change this to

{if some random number} then
$db_user = 'username';
$db_passwd = 'password';
else {if some other random number}
$db_user = 'username2';
$db_passwd = 'password2';
else {if some other random number}
$db_user = 'username3';
$db_passwd = 'password3';
...

etc.


How can I do this?

Ben_S

Liverpool FC Forum with 14 million+ posts.

minstrel

#2
No.

What will that do and how will it help?

I was under the impression that would increase server load in some way...

It's shared hosting,, not dedicated...

Ben_S

It means MySQL won't close the connection when it's finnished with it meaning that it will be reused when someone else visits. As for increasing load, in reality, it should decrease it as it gets rid of the overhead of opening and closing connections, although the way some shared hosts have things set up, they don't like persistant connections.
Liverpool FC Forum with 14 million+ posts.


Skipdawg

Let us know how it goes. I may give it a shot on my VPS if it helps some.
Skipdawg's Community

Powered by SMF 1.1.3


minstrel

Update: It's been about 48 hours now since I made the change to "Persistent connections". So far, so good -- nothing has crashed and I haven't received another "excess connections" error from tyhe server.

Ben_S

Would expect it to be fine, my forum runs at a nice gentle 1788 connections / hour and is probably a tad larger than yours.
Liverpool FC Forum with 14 million+ posts.

Gargoyle

Quote from: Ben_S on August 07, 2006, 02:14:52 PM
the way some shared hosts have things set up, they don't like persistant connections.

Could you explain why ?? I asked my host about persistant conections and they were against me enabling it. I'm just curious as to why ??

Thanks!

Ben_S

The main reason is likely to be because the max_connections (the maximum number of concurrent connections at any one time) setting is global so if they have it set to say 500 and a lot of customers have persistant connections enabled, then they are more likely to reach that limit and futhur connections will be locked out for a short while giving connection errors.
Liverpool FC Forum with 14 million+ posts.

Gargoyle


Advertisement: