nginx
resource_error
ai_generated
true
nginx: [alert] 1024 worker_connections are not enough
ID: nginx/worker-connections-exceeded
90%Fix Rate
90%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1 | active | — | — | — |
| 1 | active | — | — | — |
Root Cause
nginx worker process ran out of connection slots. Default 1024 is too low for high-traffic sites.
genericWorkarounds
-
92% success Increase worker_connections to match expected concurrency
events { worker_connections 4096; } # in nginx.conf; rule of thumb: 2-4x expected concurrent connectionsSources: https://nginx.org/en/docs/http/ngx_http_core_module.html
-
90% success Increase OS file descriptor limits
In /etc/security/limits.conf: nginx soft nofile 65536; nginx hard nofile 65536; also: worker_rlimit_nofile 65536; in nginx.conf
-
82% success Enable multi_accept to handle multiple connections per event
events { multi_accept on; use epoll; } # accept all pending connections at once instead of one by one
Dead Ends
Common approaches that don't work:
-
Set worker_connections to extremely high value like 1000000
72% fail
Each connection uses memory (~1-2KB). Unreachable high values waste kernel resources. Set based on actual peak + headroom.
-
Only increase worker_connections without checking ulimit
85% fail
OS file descriptor limit (ulimit -n) must be >= worker_connections. nginx cannot open more FDs than the OS allows.