Page 1 of 1

Shared server - is my forum too big now?

Posted: Wed Nov 12, 2008 7:17 pm
by garble
I'm getting the mysql max_connections error on a daily basis during busy times. I'm trying to figure out if it's because it's on a shared server and I've outgrown it, or it's a scripting problem because I've done something wrong with a modification, or something else. Any comments would be welcome.

1. Forum is up to 20-40GB bandwidth per month, 10k-20k pageviews per day (over 30k daily this week), or about 500k pageviews per month. Host says they allow 100 connections at any one time for the whole server. The odd thing is I have other php/mysql websites on the same server, I never see the max_connections error on them, and they're still available even when the phpbb forum is not.

Would it make sense that I've just outgrown hosting capacity and should move to a dedicated server? Or is there another option?

2. I've checked all mysql connections, that I've added myself, are closed at the end of the script. And I changed all "pconnects" to "connects". From what I've been reading, that shouldn't matter anyway.

3. Is there a 3rd (or 4th or ...) possibility I haven't thought of that I could check?

Re: Shared server - is my forum too big now?

Posted: Wed Nov 12, 2008 8:46 pm
by Lumpy Burgertushie
I bet you have simply outgrown your shared server.

robert

Re: Shared server - is my forum too big now?

Posted: Wed Nov 12, 2008 9:28 pm
by ric323
YOu might find some good ideas in this topic: [2.0.x] Tweaks for large forums

Re: Shared server - is my forum too big now?

Posted: Thu Nov 13, 2008 3:31 am
by Dog Cow
One thing you could do would be to create a second MySQL user and add it to your database. Then when you get the error, you can switch users and see what effect that has.

This is cool: it's a change to config.php to rotate MySQL users. What we do here is to assume both have the same privileges to the database, then we can use mt_rand() to determine which one to use for each page load.

Code: Select all

$dbms = 'mysql4';
$dbhost = 'localhost';
$table_prefix = 'phpbb_';
$dbname = 'phpbb2devboard';
if (mt_rand(1,2) == 1)
{
    $dbuser = 'dougk';
    $dbpasswd = 'dougkff7';
}
else
{
    $dbuser = 'dogcow';
    $dbpasswd = 'macos1988';
}

So you'd just fill out those details to match your actual setup, and then try it out.

Re: Shared server - is my forum too big now?

Posted: Sun Dec 28, 2008 8:24 am
by garble
Thanks for your replies, appreciate it (and apologies for taking so long to reply myself).

>Dog Cow: That sounds useful, I'll try that. I had already added an if ... else to force several disconnections whenever the limit was reached, but it didn't seem to have the expected effect.

>ric323: Thanks, yes that's a great topic. I didn't think my forum was that big but I might have to revisit that assumption.

>Lumpy Burgertushie: Yes, I was sort of afraid of that, but if that's the case then at least I don't have to keep worrying if I've made an error with one of my hacks.