limited number of mysql connections

Subscribe to limited number of mysql connections 2 post(s), 2 voice(s)

 
Avatar alexis perrier 2 post(s)

My account has a max_user_connections of 10.
Somehow I have just had a “User ‘qameha’ has exceeded the ‘max_user_connections’ resource (current value: 10)” although there was only one user using the application (me).
I checked with Show processlist; which showed only 3 connections.
I guess my application might be opening too many connection for its own good at some point but I don’t know how to investigate this probable issue.

However, I have a feeling that this is an issue that will creep up on me at the worst of times and I would like to take preventive steps.

1) why are we allowed so few connections ? is there a way to increase the max_user_connections for my account ?

Mysql documentation talks about 150 default connection. Quote : “Beginning with MySQL 5.1.15, its default value is 151 to improve performance when MySQL is used with the Apache Web server. (Previously, the default was 100.)”

2) How can I prevent running out of connections before it happens ?

Thanks
Alexis

 
Avatar Rahoul Baruah Administator 31 post(s)

Hi,

Most people use our shared MySQL cluster (sqlreadwrite.brightbox.net). Because it is shared, we limit the number of connections per user – to prevent one user from hogging all the resources. We grant extra connections based upon the Brightboxes you have – a 256 box has 5, a 512 has 10 and so on (these are listed here: http://www.brightbox.co.uk/rails-hosting-pricing) – so people with bigger boxes have more connections to play with.

Ordinarily a single mongrel or passenger process should only use a single connection. Occasionally passenger can keep extra connections open as it goes through a graceful restart (it holds old processes open till they are complete whilst simultaneously starting new ones) – however, this is pretty rare.

At present, the only way to get extra connections is to buy another box (or upgrade to a larger one). However, as an alternative, you could install a local copy of MySQL onto your own box (although you lose the failover that our cluster provides); as this is exclusive to you, you are free to use it how you wish. Another alternative is to buy one of our managed MySQL clusters – this effectively gets you the same as the shared cluster (failover, backups etc), but all to yourself.

Hope that helps,

Rahoul.

Signup or login to contribute