Nginx sits in front of your app, so its limits reach users as dropped connections, 502s and 504s. Tune worker connections and upstream keepalive first, then set timeouts and alerts. Start with Nginx Tuning for High Traffic.
- Nginx Prometheus Exporter and 5xx Error Rate Alerts
Scrape stub_status for connections and the VTS module for status codes and upstream latency, so a rising nginx 5xx error rate pages you before users do.
- Nginx Upstream Timed Out, 502 and 504 Errors
Set proxy timeouts from your slowest real endpoint, cap retries and stop one slow response from ejecting a server, so peak load gives fewer 502s and 504s.
- Nginx Tuning for High Traffic
Size worker_connections for two sockets per request and keep a right-sized upstream keepalive pool, so nginx stops dropping connections at peak.