How many simultaneous connections can a server handle?

Well, it depends on quite a few things, but let’s start by looking at some server settings and example web applications.

Arguably the two most important settings that govern how much simultaneous traffic a Linux server running the LAMP stack can handle are the Apache MaxClients setting and the MySQL/Mariadb max_connections setting.  From here on I’ll refer to both of these settings as your max connection settings.  If set too high your web and database software can consume all of a server’s available memory and crash it, which can be very painful.  If set too low your web server will slow incoming traffic unnecessarily.

For example, if your application is streamlined and doesn’t use much RAM to render web pages then your max connections settings can be set very high, allowing hundreds of simultaneous users to your site on a small VPS with, say, 2GB RAM.  However, a WordPress site with tons of plugins – some poorly coded with non-optimized MySQL queries – can use so much RAM that the max connections settings should be set very low, in order to prevent RAM swapping and server crashes.

Another factor to take into account is how fast your web pages are rendered.  Web page connections can take anywhere from a few milliseconds up to many seconds for a server to render, which is also determined by how streamlined your application is written and optimized.  I.e.  A simple html or javascript-only site with no PHP or MySQL connections would take almost no amount of time to render (html and javascript are normally processed by the user’s browser, not by the server.)  However, that same bloated WordPress site could take many, many seconds for the server to parse the code, make the database queries, and then put it together send to the customer.  (Keep in mind that I think WordPress is great!  And the WordPress core runs very fast, its just that plugins are unregulated and can be messy.)

 

The point here is that “simultaneous connections” is also a very subjective thing. That bloated WordPress site with the max connections settings set to 10 would be able to handle far less traffic than our little html/javascript site with the same max connections setting set to 10 as that little site would be flying through users, while the bloated site would not.

Another consideration is that most web site’s memory and traffic usage change over time.  Your web site’s code changes, the amount of traffic a site receives changes, databases get larger and databases get optimized, all of which change the amount of RAM that it takes the server to render your pages.  Which of course means that your max connection settings need to change over time as well.

So what is a good DevOps/SysAdmin supposed to do to keep their sites running fast without crashing servers?  Keep your code tight, your db’s optimized, and monitor your Apache and MySQL memory usage and page render times and re-tune those max connection settings often.

Or you sign up for a Brownrice SmartVPS and we’ll take care of the monitoring and max connection settings for you!  Our custom SmartVPS algorithm constantly monitors Apache and MySQL memory usage and adjusts the max connections settings on the fly and will keep you informed with email alerts and Dashboard Performance tools.

And remember: Fast speeds equals lots of happy customers and good search engine rankings, so this is well worth your time.

Questions?  Feel free to ask in the comments below!

About Oban

Oban manages the Brownrice Internet staff, keeps the network humming, and chases his wife and twin boys around during his time off.

Leave a Reply

Your email address will not be published. Required fields are marked *