How Many Concurrent Connections Does Workerman Support

The concept of concurrency is quite vague. Here, we will illustrate it using two quantifiable metrics: concurrent connections and concurrent requests.

Concurrent connections refer to the total number of TCP connections maintained by the server at a given moment, irrespective of whether there is data communication on these connections. For example, a message-pushing server may maintain connections for millions of devices, and since data communication on these connections is infrequent, the load on this server may be nearly zero. As long as there is enough memory, it can continue to accept connections.

Concurrent requests are generally measured using QPS (queries per second, which indicates how many requests the server processes per second). The number of TCP connections at the current moment is not of primary concern. For example, if a server has only 10 client connections and each client connection sends 10,000 requests per second, then the server needs to support a throughput (QPS) of at least 10 * 10,000 = 100,000 per second. Assuming that 100,000 is the maximum throughput of this server, if each client sends 1 request per second to the server, this server can support 100,000 concurrent clients.

Concurrent connections are limited by the server's memory. Generally, a Workerman server with 24GB of memory can support approximately 1,200,000 concurrent connections.

Concurrent requests are limited by the CPU processing power of the server. A Workerman server with 24 cores can achieve a throughput of 450,000 requests per second (QPS), with the actual value varying based on business complexity and code quality.

Note

High concurrency scenarios must have the event extension installed; please refer to the installation configuration section. Additionally, it is necessary to optimize the Linux kernel, particularly the limit on the number of open files per process. This can be found in the kernel tuning section of the appendix.

Load Testing Data

Data sourced from the third-party authority testing organization techempower.com Round 20 Load Test
https://www.techempower.com/benchmarks/#section=data-r20&hw=ph&test=db&l=zik073-sf

Server Configuration:
Total Cores 14, Total Threads 28, 32 GB of memory, Dedicated Cisco 10-gigabit Ethernet switch
Business Logic:
Database query logic, database is PostgreSQL, using PHP 8 with JIT
QPS is over 390,000