Technologies/NGINX/gunicorn.worker.connections
NGINXNGINXMetric

gunicorn.worker.connections

Active connections per worker
Dimensions:None

Technical Annotations (46)

Configuration Parameters (11)
workersrecommended: 9
For 4-core machine using formula (2 * CPUs) + 1
worker-classrecommended: gevent
Non-blocking worker type for high I/O concurrency in dashboards
threadsrecommended: 1
Threads less critical when using Gevent workers
timeoutrecommended: 60
Worker response timeout in seconds; set higher than longest expected callback
worker_connections
low values cause worker hangs with keepalive connections under concurrent load
pool_sizerecommended: ≥ threads per worker, generally 4-8 per worker
must accommodate all active threads to prevent timeouts
max_overflowrecommended: 1-10
additional connections beyond pool_size during traffic spikes
pool_recyclerecommended: 3600 (1 hour)
close and reopen idle connections to avoid stale connections
pool_timeoutrecommended: 30 seconds
how long to wait for a connection before timing out
worker_classrecommended: gevent
enables asynchronous handling of multiple connections per worker
--timeoutrecommended: 600
Must be over 240 seconds to work within App Service idle connection limits
Error Signatures (5)
sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached,connection timed out, timeout 30.00exception
connect() failed (111: Connection refused)log pattern
502http status
[CRITICAL] WORKER TIMEOUTlog pattern
H12 Request Timeouterror code
CLI Commands (9)
gunicorn app:server --workers $WORKERS --worker-class gevent --bind 0.0.0.0:8000 --timeout 60remediation
pip install gunicorn geventremediation
curl --unix-socket /run/gunicorn.sock http://diagnostic
systemctl status gunicorndiagnostic
systemctl status caddydiagnostic
dmesg -T | egrep -i 'memory'diagnostic
dmesg -T | egrep -i 'oom'diagnostic
pg_stat_activitydiagnostic
ulimit -ndiagnostic
Technical References (21)
WSGIprotocolGeventcomponentDash callbackscomponentASGIprotocolEventletcomponentCelerycomponent/run/gunicorn.sockfile pathsystemd socket activationconceptgthreadcomponentkeepaliveconceptulimitconceptkeepalive timeoutconceptSNAT port exhaustionconcepthttp.disconnectcomponentasyncio.CancelledErrorexceptionasyncio.wait_forcomponentgeventcomponentuvicorncomponentgthread workercomponentself.nr_connscomponentself.worker_connectionscomponent
Related Insights (17)
Worker pool exhaustion causes exact 60-second request hangscritical
Synchronous WSGI workers block on I/O preventing concurrent request handlingwarning
Insufficient worker count for moderate concurrent usage causes request queueingwarning
Slow backend responses cause concurrent request memory buildupwarning
Gunicorn unix socket hangs for 2-45 minutes before self-recoverycritical
Worker and thread tuning controls memory vs CPU tradeoffinfo
gthread workers hang at worker_connections limit with keepalive connectionscritical
SQLAlchemy QueuePool limit exceeded causes request timeoutscritical
Database connections exceed calculated maximum due to leaked connectionscritical
Connection queuing with sync workers under high concurrent loadwarning
Nginx connection refused errors with no application logswarning
Worker timeout from long running requests exceeding timeout thresholdwarning
Slow external dependencies cause worker saturation and cascading failureswarning
Limit worker connections to prevent memory accumulationwarning
Request persistence after platform timeout causes resource wastewarning
IO-bound tasks require async or threaded workersinfo
gthread worker accepts connections beyond thread capacitywarning