nginx Tuning
worker_connections, etc.
Overview
nginx defaults are conservative on purpose. They work for low-traffic deployments and break down in interesting ways at scale. Tuning matches the configuration to the workload; the right knobs at the right values turn nginx from "fine" into "best-in-class."
- worker_processes auto. One worker per CPU core; the default is right for almost everyone, over-subscribing produces context-switch overhead.
- worker_connections. Each worker handles many connections; the 1024 default is low for busy servers, 4096 or higher matches modern fleets.
- keepalive_timeout. HTTP keepalive reduces handshake cost; tune the timeout to match real client behaviour, not the conservative default.
- proxy_buffering and TLS settings. Buffering off for streaming responses; cipher suite, session cache, and OCSP stapling tuned for fast, secure TLS at scale.
The approach
Measure, then tune, then measure again. Tuning without metrics is guessing; the team that builds an evidence-based tuning discipline gets compounding returns.
- Baseline first. Record default-config metrics (req/s, latency, error rate) before changing anything; without a baseline, you cannot prove the tuning helped.
- One parameter at a time. Each change isolated so cause and effect are clear; multi-variable changes obscure the signal and waste the experiment.
- Status modules for visibility. stub_status or VTS module exposes worker connections, accepted, handled, requests; without them, tuning is blind.
- Documented rationale per parameter. Comment in the config explains why each non-default value is set; preserves the rationale for the next engineer who reads it.
Why this compounds
nginx tuning compounds across every server: tuned config templates ship with new services, the team learns nginx by tuning it, and capacity per node climbs as tuning matures.
- Higher capacity per node. Tuned nginx serves more traffic per CPU; operational cost drops linearly with the gain.
- Lower tail latency. Tuned configuration produces predictable p99; the user-visible improvement compounds across every request.
- Reusable templates. Tuned config becomes the default template; new services inherit the team's discipline without re-discovering it.
- Institutional knowledge. Tuning teaches the team how nginx actually behaves under load; that knowledge survives in the team, not just the config.
nginx tuning is one of those operational disciplines that pays off across years. Nova AI Ops integrates with nginx telemetry, surfaces patterns, and supports the team's web tier discipline.