Results 1 to 5 of 5

Thread: Questions about MySQL: Too Many Connections

  1. #1
    Member
    Join Date
    Oct 2004
    Posts
    88

    Default Questions about MySQL: Too Many Connections

    • How many connections can MySQL have?
    • Is the number of allowed connections based on per-account, or per-server?
    • Is there any way to monitor MySQL connections?

  2. #2
    Administrator AndrewT's Avatar
    Join Date
    Mar 2004
    Location
    Tulsa, OK
    Posts
    3,634

    Default

    All of our servers have a limit of 10 concurrent connections for any given MySQL user. For all practical purposes on a busy site (as far as shared hosting is concerned), you wouldn't use more than 2-3 ever at the same time and even then it would only last a few ms. This limit is just in place to prevent abuse, it doesn't mean you are free to run 10 concurrent connections all the time. Unfortunately this is not something easily tracked by an end user but if you are getting this message on our servers then it almost always means you have a script that is running a poorly written SQL query.

  3. #3
    Member
    Join Date
    Oct 2004
    Posts
    88

    Default

    Quote Originally Posted by AndrewT View Post
    All of our servers have a limit of 10 concurrent connections for any given MySQL user. For all practical purposes on a busy site (as far as shared hosting is concerned), you wouldn't use more than 2-3 ever at the same time and even then it would only last a few ms. This limit is just in place to prevent abuse, it doesn't mean you are free to run 10 concurrent connections all the time. Unfortunately this is not something easily tracked by an end user but if you are getting this message on our servers then it almost always means you have a script that is running a poorly written SQL query.
    10 seems really low. I get this error often with forums (various forum software.) And I'm talking about small forums too, nothing huge.

  4. #4
    Administrator AndrewT's Avatar
    Join Date
    Mar 2004
    Location
    Tulsa, OK
    Posts
    3,634

    Default

    It really isn't. You should not be using anywhere near that amount. This isn't the same as having 10 concurrent users on a forum or blog. Connections to MySQL open, execute, and close near instantaneously in most cases. If you run into this error then you have a query that is taking too long to execute or a query that is locking tables and causing queries to queue up waiting on the lock thereby permitting this limit to be reached.

  5. #5
    Senior Member
    Join Date
    Sep 2005
    Location
    Russia, Nizhny Novgorod
    Posts
    315

    Default

    Also note, that many PHP scripts use 'persistent' connections by default. I do not know the details on how PHP is set up with Dathorn, but I assume that a new processes is forked for each request, at least it used to be the case. In this scenario, persistent connections are not only useless but plainly harmful and you absolutely should turn them off.

    The limit of 10 concurrent connections is not so easy to reach if the application is programmed correctly. I suggest you having a look at scripts configuration first.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •