Professional Web Applications Themes

max_connections? - MySQL

Hey all, Occasionally, I get a "Too many connections" error from MySQL on my webhost, and I notice that "max_connections" is set to 100. Is this a typical value for a web hosting company? "max_connections" is a server-wide limit, right? I wonder how many websites are sharing those 100 connections. Should I be looking for a host that offers more concurrent connections? Cheers, Nicholas Sherlock -- http://www.sherlocksoftware.org...

  1. #1

    Default max_connections?

    Hey all,

    Occasionally, I get a "Too many connections" error from MySQL on my
    webhost, and I notice that "max_connections" is set to 100. Is this a
    typical value for a web hosting company? "max_connections" is a
    server-wide limit, right? I wonder how many websites are sharing those
    100 connections. Should I be looking for a host that offers more
    concurrent connections?

    Cheers,
    Nicholas Sherlock

    --
    http://www.sherlocksoftware.org
    Nicholas Guest

  2. #2

    Default Re: max_connections?

    >Occasionally, I get a "Too many connections" error from MySQL on my 

    There are several versions of this limit:

    max_connections is server-wide.
    max_user_connections is a limit on any particular MySQL user. 0
    indicates no limit (subject to the server-wide limit). This limit
    prevents one user going nuts blocking out the other users. Because
    of oversell, it probably won't prevent half the users blocking out
    the other half, which is likely your problem.

    A MySQL user, after 5.0.3, may have a connections resource limit.
    If this is specified, it overrides max_user_connections.
    This may not be used much by hosting companies as MySQL 5.0 adoption
    and using its features may not be widespread yet.

    What you may be looking for in a host is a large value of:

    max_connections minus the sum of max_user_connections for all the
    other users (in other words, the number of connections reserved
    exclusively for you, no matter how piggy the others get).


    Note that persistent connections (using PHP, for example) can make
    this problem MUCH, MUCH WORSE. Suppose Apache is configured for a
    maximum of 50 processes (it can only handle 50 simultaneous hits,
    any others wait. This isn't a particularly generous configuration).
    You have 40 users, each with their own login and database. With
    persistent connections, and all sites reasonably active, eventually
    you'll hit 40 connections in each of 50 processes = 2000 connections.
    Even if the site never gets more than one hit a minute combined for
    all customers, and has never needed more than 5 simultaneous
    connections in a year.

    Gordon Guest

  3. #3

    Default Re: max_connections?

    Gordon Burditt wrote: 
    >
    > There are several versions of this limit:[/ref]

    Thank you for your very nice explanation.
     

    Ack, my webhost has max_user_connections set to 0. Since they're running
    the ancient "4.0.23-max" version, there probably isn't any magic going
    on behind the scenes, either. Perhaps I shouldn't have gone for the
    cheapest host to offer the features I wanted, after all. ;)

    Cheers,
    Nicholas Sherlock

    --
    http://www.sherlocksoftware.org
    Nicholas Guest

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139