[英]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.我将在服务器上设置一个 LAMP 堆栈,并将其用作我的移动应用程序的后端,该应用程序每天有大约 1000 名活跃用户。
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.
我在许多托管服务提供商的网站上看到他们提供固定数量的并发用户,例如 20 或 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?
它是否仅取决于服务器的硬件,例如可用的 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.
我将在服务器上设置一个 LAMP 堆栈,并将其用作我的移动应用程序的后端,该应用程序每天有大约 1000 名活跃用户。
If you care about the performance, you probably should use LEMP instead of LAMP.如果您关心性能,您可能应该使用 LEMP 而不是 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.
我在许多托管服务提供商的网站上看到他们提供固定数量的并发用户,例如 20 或 100。
All servers you can buy can be divided into 3 simple groups:您可以购买的所有服务器可以分为 3 个简单的组:
If you see any limitation like " X max connections" or " Y SQL queries per second", that means you talk about the shared hosting.如果您看到任何限制,例如“ X最大连接数”或“ Y SQL 每秒查询数”,这意味着您谈论的是共享主机。 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.
如果您不想听到无聊的限制,请至少坚持使用 VPS/VDS,您唯一的限制将是内核、RAM、HDD 空间和流量使用。
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).
大多数网络服务器 (Apache/Nginx) 的默认行为是将连接保持在队列中,直到解释器 (PHP-CGI/PHP-FPM) 可用或在达到超时时终止(以先到者为准)。 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). PS如果你真的想测试你的服务器性能,你总是可以使用回归测试/基准测试软件或编写自己的(用连接淹没你自己的服务器,直到它死掉)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.