What Is Nginx’s Maximum Concurrent Connections? A Complete Guide

The article explains that Nginx’s maximum concurrent connections are not a fixed number but are calculated from the worker_processes and worker_connections settings and are ultimately limited by the operating system’s file‑descriptor (ulimit) limits, providing formulas, an example configuration, and commands to verify the limits.

Architect Chen
Architect Chen
Architect Chen
What Is Nginx’s Maximum Concurrent Connections? A Complete Guide

Nginx’s maximum concurrent connection count is not a static value; it is determined jointly by Nginx configuration parameters and the operating system’s resource limits.

For a typical web server the theoretical maximum is calculated as:

max connections = worker_processes × worker_connections

worker_processes is usually set to the number of CPU cores, or to auto so Nginx detects it automatically. worker_connections defines the maximum number of connections a single worker process can handle and must not exceed the OS limit ulimit -n (the maximum number of open file descriptors per process).

Example configuration:

worker_processes 4;

events {
    worker_connections 10240;
}

This yields a theoretical maximum of 4 × 10240 = 40960 concurrent connections, but the actual usable number also depends on the system’s file‑descriptor limits.

To inspect the current Nginx settings and the OS limits, the article suggests the following commands:

# View current Nginx configuration values
nginx -T | grep 'worker_processes|worker_connections|worker_rlimit_nofile'

# Check the process file‑descriptor limit
ulimit -n

# View the system‑wide maximum number of file descriptors
cat /proc/sys/fs/file-max

If the OS limit is lower than the configured worker_connections, increasing the latter will have no effect, so the limits must be raised accordingly.

concurrencyNginxworker_processesserver configurationulimitworker_connections
Architect Chen
Written by

Architect Chen

Sharing over a decade of architecture experience from Baidu, Alibaba, and Tencent.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.