简体   繁体   中英

What determines a server's or LAMP stack's max concurrent users?

I'm looking to build my own server for the fun of it and in order to learn about the process.

I will be setting up a LAMP stack on the server and use it as a back-end for my mobile application that has some 1000s of daily active users.

But I am completely clueless as to what determines the limits of my server. I see on many hosting providers' websites that they offer a fixed amount of concurrent users, like 20 or 100.

What are the reasons that determine the maximum number of concurrent users for a server ? Is it just dependent on the server's hardware, like available RAM? Does it have to do with code or software? What happens to users who try to access the server when the maximum limit has already been reached?

Your question is not really about any code issue, but since you asked...

I will be setting up a LAMP stack on the server and use it as a back-end for my mobile application that has some 1000s of daily active users.

If you care about the performance, you probably should use LEMP instead of LAMP.

But I am completely clueless as to what determines the limits of my server. I see on many hosting providers' websites that they offer a fixed amount of concurrent users, like 20 or 100.

All servers you can buy can be divided into 3 simple groups:

  1. Shared hosting (you and 1000 other folks share the same server).
  2. VPS/VDS (the server is divided into N isolated parts and your resources are guaranteed: M CPU cores, K RAM, T GB HDD/SSD, S GB in/out traffic).
  3. Dedicated servers (you own everything).

If you see any limitation like " X max connections" or " Y SQL queries per second", that means you talk about the shared hosting. You are not allowed to consume more than your limit, otherwise all clients of the same server may suffer from your website/service "popularity". Stick to the VPS/VDS at least if you don't want to hear about boring limitations, your only limitations will be cores, RAM, HDD space and traffic usage.

What happens to users who try to access the server when the maximum limit has already been reached?

Depends on your client's software configs and server's configs. The default behavior for most of clients (like browsers) is to wait until a specific timeout. The default behavior for most of webservers (Apache/Nginx) is to keep connections in a queue until the interpreter (PHP-CGI/PHP-FPM) would become available or die if a timeout is reached (whatever comes first). But that's configurable for each actor in that scheme from increasing the timeout to dropping the extra load immediately.

PS If you really want to test your server performance, you can always use a regression testing/benchmarking software or write your own (flood your own server with connections until it would die).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM