Forum Moderators: open

Message Too Old, No Replies

MYSQL Max connection error

Traffic increases, site crashes!

         

karim0028

4:51 pm on Mar 10, 2008 (gmt 0)

10+ Year Member



Hi Guys,

I am on a shared server... I am not a developer... I hired out to build my site... But the most annoying thing happens everytime i seem to get more traffic....

I get an error...

Warning: mysql_connect() [function.mysql-connect]: User #*$!
already has more than 'max_user_connections' active connections in /
home/public_html/admin/includes/functions/database.php on line 19
Unable to connect to database server!

Now, i am in the middle of some SEO now and i dont want this to ruin my SEO effort as it is costing me time, money and effort!

My developer says its a hosting issue... My hosting says its a bug in my code....

Can someone please explain what this means? How can i fix this? As it seems that everytime my visitors increase the site goes down for the count!

I am debating when would be the appropriate time to change over to a dedicated server/host.... Is it the host that is limiting my sites growth?

Your help would be greatly appreciated!

Thanks,
Karim

physics

6:38 pm on Mar 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That error means that you've reached the maximum number of connections allowed to the database.

The maximum number of simultaneous connections allowed to any given MySQL account. A value of 0 means “no limit.”

[dev.mysql.com...]

This is lower than the total number of connections allowed, which is max_connections


The number of simultaneous client connections allowed. By default, this is 100. See Section B.1.2.7, “Too many connections”, for more information.

So, by switching to a dedicated server where you are the only one using the database, and are free to increase max_connections up to the point your server can handle, may solve your problem.

On the other hand it may be possible to alter the code so that it's more efficient. However, the developer you hired may either not be able to accomplish this or might charge A LOT for it so maybe it isn't worth it.

If you're getting a lot of traffic (and thus are making some money) then you should definitely grab a dedicated server for $100-$200/month. Your site will be faster and there won't be any unnecessary restrictions like max_user_limit.

We'd need more info on how many hits & datbase connections you're getting to be more specific but my thought is ... get a dedicated server.

karim0028

1:05 am on Mar 11, 2008 (gmt 0)

10+ Year Member



So, would a dedicated server have no max connection? I am not getting that much traffic; but it seems that whenever there is any sort of spike the server dies....

Thats whats kind of boggling, so far i am getting about 100 visits per day... So, were not talking much here... But, i am doing SEO and anticipating an increase; i just dont want to spend the money on dedicated when its not consistent traffic just yet....

The thing i dont understand is this max limit the number of people that can be on the site at any one time? The limit is like 25 currently.... Thats pretty low by any standard....

jtara

7:28 pm on Mar 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure how you are getting 25 open connections with 100 users/day!

ARe you closing connections after you use them?

phranque

10:56 pm on Mar 12, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the "number of people that can be on the site at any one time" isn't really the same as simultaneous connections to the database unless they happen to be simultaneously loading a page that requires a db connection.

if you are using mod_perl without a persistent db connection, for example, you might have problems if the connections aren't closed.

physics

11:45 pm on Mar 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh, if you only have 100 visitors a day then I'd say you should get your programmer to address this.