Results 1 to 19 of 19
  1. #1
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19

    MySQL connection limit question

    I've been shopping around for hosts and I've seen more then a few times information given about how many query/connections per user one could make on a particular host.

    I was wondering if someone could explain it a bit more for me? Like what it's all about.

    Does the "user" count as me accessing the MySQL databases I've got set up? Like for example if I'm accessing and working with a CMS? Something like: I've logged into my manager panel, this counts as one connection, or I'm editing this page this also counts as a connection.

    Or is it for outside users, like: Bob signs into his favorite website and that query goes to the corresponding database and now he sees all his personalized stuff.

    Or is it neither of these?

    Also, let's say there's a 25 connections per user limit with a host. Is that 25 connections an hour? a day? a month?

    My apologies if these seems like it should be really obvious stuff.

    Thanks!

  2. #2
    Join Date
    May 2011
    Posts
    57
    Yes, Accessing the CMS also counts as mySQL usage, as the CMS pulls data from the database. One person Accessing your CMS = 1 mySQL database connection.

    The 25 connections is concurrent (simultaneous connections) I think, as 25 an hour/day/month is too less.

  3. #3
    Join Date
    Nov 2006
    Location
    Karachi, Pakistan
    Posts
    1,349
    The duration is until the connection is made, the query run, the result returned to the script running on the server and the connection closed. So the connection is only active for a short timespan. On the order of a few dozen to a few hundred milliseconds. It definitely is NOT active while you are viewing the page.

    25 connections means the maximum number of connections at a time. During a day you can have thousands of connections that are established and then closed. Also 25 connections does not mean 25 simultaneous users. The actual number of users will be higher because, as I said before, connections are opened and closed very fast. How many simultaneous users does it mean? Depends on your website. Anyway 25 is a good number for shared hosting.

    One last point 25 does not mean that if you run out of connections your website stops functioning. I believe there is a queuing mechanism so that some connections are simply delayed. Your website will slowdown not stop working completely.

  4. #4
    Join Date
    Jul 2011
    Location
    ATL,DFW,PHX,LAX,CHI,NJ
    Posts
    696
    Thought some forum software and such open persistent connections to handle all requests over it? Maybe I misunderstood that feature, but I've used it with several bulletin boards in the past. Never really had a need to figure it out even when we were running 40-50 people on at the same time never saw an issue.
    █ Total Server Solutions
    OnApp Cloud Solutions, CDN, DNS, Load Balancers, and Hybrid Dedicated Servers
    █ Colocation with Colo@
    Visit us at http://www.totalserversolutions.com/

  5. #5
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19
    So can many users on a shared host server making a lot of MySQL requests cause problems?
    Like let's say I'm accessing my CMS while another user in their section of the server is checking their email, and someone else is updating their blog, etc.
    And if so, could this affect memory usage on the entire server? Could it cause Php requests to the databases to time out or fail to process?

  6. #6
    Join Date
    Nov 2006
    Location
    Karachi, Pakistan
    Posts
    1,349
    Quote Originally Posted by drding View Post
    So can many users on a shared host server making a lot of MySQL requests cause problems?
    Like let's say I'm accessing my CMS while another user in their section of the server is checking their email, and someone else is updating their blog, etc.
    And if so, could this affect memory usage on the entire server? Could it cause Php requests to the databases to time out or fail to process?
    The limit of 25 concurrent connections is per shared hosting account not for the entire server. A typical shared hosting server can probably handle hundreds of simultaneous MySQL connections.

    All your other questions are related to server resources. Unless your hosting provider has overloaded the server with too many users it should not be a problem. So the question to ask is are you buying hosting from a dodgy provider? A reputable provider will not overload the server.

  7. #7
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19
    Quote Originally Posted by Website themes View Post
    All your other questions are related to server resources. Unless your hosting provider has overloaded the server with too many users it should not be a problem. So the question to ask is are you buying hosting from a dodgy provider? A reputable provider will not overload the server.
    Would it point to an overloaded server if I'm seeing internal server errors and items in my server error log like this one "(12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/myusername/public_html/manager/index.php"

    And I see that error when using two different CMS's including WordPress.

    Is there any way to see how many users are on my server?

  8. #8
    Join Date
    Oct 2010
    Location
    Kent
    Posts
    4,218
    Quote Originally Posted by drding View Post
    Would it point to an overloaded server if I'm seeing internal server errors and items in my server error log like this one "(12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/myusername/public_html/manager/index.php"

    And I see that error when using two different CMS's including WordPress.

    Is there any way to see how many users are on my server?
    It means that the host is running PHP under suPHP, which is a good thing. That means that each time a PHP page is parsed, Apache starts a new PHP instance. When it tried to do that, it needed to allocate some memory, but it couldn't do so. Basically: {max-memory-per-php-script} * {number-of-currently-running-php-scripts} > {total-available-memory-on-server}

    So, yes, overloaded.

    How many users on my server? No host would tell you that. Even if you knew it, without knowing what resources they each use it wouldn't tell you much. If they were mostly static users, it wouldn't have any impact
    James Oakley, OakHosting.NET | UK Based | US Servers | Pay in , $ or
    Affordable, Reliable Shared Hosting for 4 years. Specialising in Charities and Churches
    New: cPanel-powered Backup and Storage Space: with automated backups for hosting clients
    ... Drupal a speciality; PHP 5.3, 5.4, 5.5 or 5.6; Drush; Git; cPanel; Varnish; Apache 2.4

  9. #9
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19
    Quote Originally Posted by JamesOakley View Post
    It means that the host is running PHP under suPHP, which is a good thing. That means that each time a PHP page is parsed, Apache starts a new PHP instance. When it tried to do that, it needed to allocate some memory, but it couldn't do so. Basically: {max-memory-per-php-script} * {number-of-currently-running-php-scripts} > {total-available-memory-on-server}

    So, yes, overloaded.

    How many users on my server? No host would tell you that. Even if you knew it, without knowing what resources they each use it wouldn't tell you much. If they were mostly static users, it wouldn't have any impact
    Would a high CPU% also be indicative of an overloaded server? Like if I look at my server via PuTTy and saw MySQL running any where between 3% to 200% (towards the higher end pretty regularly, highest I saw a few moments ago was 245%) is that a bad sign or normal fluctuations?

  10. #10
    Join Date
    Nov 2006
    Location
    Karachi, Pakistan
    Posts
    1,349
    Quote Originally Posted by drding View Post
    Would it point to an overloaded server if I'm seeing internal server errors and items in my server error log like this one "(12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/myusername/public_html/manager/index.php"

    And I see that error when using two different CMS's including WordPress.

    Is there any way to see how many users are on my server?
    Yep that's an overloaded server. Complain to the provider. Maybe they'll fix it. If they BS you its time to switch hosts.

    Quote Originally Posted by drding View Post
    Would a high CPU% also be indicative of an overloaded server? Like if I look at my server via PuTTy and saw MySQL running any where between 3% to 200% (towards the higher end pretty regularly, highest I saw a few moments ago was 245%) is that a bad sign or normal fluctuations?
    What's the server load number? Also what CPU does the server have? Under centos you can find this out by doing a :

    uptime;
    cat /proc/cpuinfo

  11. #11
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19
    Quote Originally Posted by Website themes View Post
    Yep that's an overloaded server. Complain to the provider. Maybe they'll fix it. If they BS you its time to switch hosts.



    What's the server load number? Also what CPU does the server have? Under centos you can find this out by doing a :

    uptime;
    cat /proc/cpuinfo
    You have to forgive me, I just downloaded PuTTy and looked up how to find the top processes. So I need a bit of guidance.

    How do I find the server load number?

    when I put in uptime I get this:
    22:16:58 up 4 days, 23:24, 2 users, load average: 0.70, 0.78, 0.67

    I tried putting in cat /proc/cpuinfo and I got a message that there was no such file or directory. So I'm assuming I'm doing something wrong.

  12. #12
    Join Date
    Oct 2010
    Posts
    1,784
    That's a nice load average (for the moment).
    Hosting is like a box of chocolates, you never know what you're gonna get.

  13. #13
    Join Date
    Nov 2006
    Location
    Karachi, Pakistan
    Posts
    1,349
    The number 0.70, 0.78 and 0.67 are your load average at different time intervals. I think its 1 minute, 5 min and 15 min. Anyway your server load is well under control.

  14. #14
    Join Date
    Jul 2011
    Location
    ATL,DFW,PHX,LAX,CHI,NJ
    Posts
    696
    You're likely to see only one instance of mysql running using top. If netstat is available try

    netstat -a

    look for mysql socket connections, but if you have this access there are plenty of programs out there that can tell you your mysql stats.
    █ Total Server Solutions
    OnApp Cloud Solutions, CDN, DNS, Load Balancers, and Hybrid Dedicated Servers
    █ Colocation with Colo@
    Visit us at http://www.totalserversolutions.com/

  15. #15
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19
    I have no idea what a socket connection looks like lol. I don't know if I should post some of what came up that I could grab (it went really fast and a bunch of it is gone, meaning it'll only let me scroll up so far) because there's IP addresses in it.

    I did see a ton of "TIME_WAIT" and "ESTABLISHED". and a few "FIN_WAIT1" and "FIN_WAIT2". I don't know if that's helpful at all.

  16. #16
    You can also check the MySQL queries by issuing the following command:

    mysqladmin -uroot -p processlist

    One query equals one connection. Keep in mind that the query stays open until it is completed. Once completed, it will automatically close which means that tracking the connections used at once is a bit tricky. Also, one person opening your web site does not mean he is creating one database query. This depends entirely on the web site you are running. For example, this web site can have multiple database entries which need to be pulled out when a user visits certain page. Each of this entry creates one database query(connection).

    I wouldn't worry that much for database connections if I were you, except the MySQL connection limit is set to a really low number (something like < 100) since most database queries are executed and closed really fast.

  17. #17
    Join Date
    Nov 2006
    Location
    Karachi, Pakistan
    Posts
    1,349
    Quote Originally Posted by dzhorov View Post
    One query equals one connection. Keep in mind that the query stays open until it is completed. Once completed, it will automatically close which means that tracking the connections used at once is a bit tricky. Also, one person opening your web site does not mean he is creating one database query. This depends entirely on the web site you are running. For example, this web site can have multiple database entries which need to be pulled out when a user visits certain page. Each of this entry creates one database query(connection).
    Hello you are mistaken and spreading your confusion to others. One query DOES NOT equal one connection. You can have run any number of queries in a single connection. In fact most PHP scripts connect to the DB at the start and then query the database as much as needed before closing the connection at the end.

  18. #18
    Join Date
    Dec 2007
    Location
    Indiana, USA
    Posts
    15,413
    Quote Originally Posted by Website themes View Post
    Hello you are mistaken and spreading your confusion to others. One query DOES NOT equal one connection. You can have run any number of queries in a single connection. In fact most PHP scripts connect to the DB at the start and then query the database as much as needed before closing the connection at the end.
    This is true, however, the distinction should be made between a persistent connection (where the connection is maintained even when queries are not being made) and a standard momentary connection (where the connection is dropped when there are no more queries pending to run).
    Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
    LiteSpeed Powered - Shared, Premium, Reseller, and VPS
    For high-end shared accounts ideal for business, check out our Premium offerings!
    http://www.mddhosting.com/ - Providing Quality Services since 2007

  19. #19
    Join Date
    Aug 2011
    Location
    New Jersey
    Posts
    19
    Quote Originally Posted by MikeDVB View Post
    This is true, however, the distinction should be made between a persistent connection (where the connection is maintained even when queries are not being made) and a standard momentary connection (where the connection is dropped when there are no more queries pending to run).

    If there's not enough memory resources to run php files connected with either of those managers, do you think that Modx and WordPress are really MySQL heavy CMS's?

    I contacted my host just recently and asked what the connection limit was for my server and they told me 40. So I would think that would be sufficient right?

  20. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Similar Threads

  1. Preventing 25 Simultaneous Connection Limit (MySQL)
    By mpcidm in forum Programming Discussion
    Replies: 3
    Last Post: 11-19-2007, 06:17 PM
  2. MySQL Concurrent Connection Limit
    By gobeyond in forum Hosting Security and Technology
    Replies: 11
    Last Post: 07-04-2007, 01:44 AM
  3. Replies: 5
    Last Post: 03-24-2006, 02:09 PM
  4. set max connection limit for specific mysql database
    By jaymef in forum Hosting Security and Technology
    Replies: 7
    Last Post: 03-24-2006, 07:15 AM
  5. MySQL Connection Limit
    By qwer123 in forum Web Hosting
    Replies: 7
    Last Post: 11-23-2000, 05:05 AM

Posting Permissions

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