How could exceeding max_user_connections bring down a website?
Posted on 2005-04-09
I've recently experienced site availability problems, whereby my host could not be reached either by trying to load web pages OR by accessing the MySql database through the admin interface OR by trying to send emails through their server.
When the site came back up, we noted for a few minutes messages such as "error 1040 too many connections" and "error 1203 exceeded max_user_connections". These were visible in areas of the site that required connections with the MySql database, such as where we provide polls or guestbook facilities for visitors.
My hosting company tells me that the problem is simply that we have outgrown a shared-server environment and that we need to upgrade to a dedicated server. I guess this makes SOME sense, but doesn't seem to me to be consistent with all the facts of what's been happening. Basically, I just can't see why too many open connections to MySql should affect the server's ability to serve web pages or simply route emails for us.
Part Two (obviously related to Part One)
Right now, I don't actively close connections to the database as a user navigates my site. There are many pages on the site, and many navigation paths through it which require reads and writes from the database, and my understanding from the manuals was that actively closing the connections is unnecessary as PHP does this automatically when appropriate. I guessed that closing them manually, for example each time a user leaves one web page and goes to another, would simply slow things down as a new connection would have to be made within a second of closing one down.
Is my understanding of this wrong? It seems relevant to ask, as I'd like to find a way of avoiding "maxing out" even if the "maxing out" in itself is not the reason for the rest of the site going down.
These might be simple questions to those of you far more skilled than I am, but I'd really like a comprehensive answer, and I'd really like to permanently resolve the issues over the next couple of days. Accordingly, I think this is worth 500 points.
Any help greatly appreciated. I had a pretty bad experience of not managing to get an effective answer to a question (not related to this problem) on this forum on my last attempt, so I'm looking to restore my faith in the usefulness of EE.