Skip to content
Performance Tuning

Performance Tuning

Recommended Multi-Core Baseline

worker_processes     auto;
worker_cpu_affinity  auto;
worker_rlimit_nofile 65535;

events {
    worker_connections 16384;
}

http {
    sendfile on;
    tcp_nodelay on;
    keepalive_timeout 65;
    keepalive_requests 10000;
    brotli_static on;

    server {
        listen 80 reuseport;
        listen 443 ssl reuseport;
        listen 443 quic reuseport;
        http2 on;
        http3 on;
        ...
    }
}

Key Tuning Levers

  • reuseport + worker_cpu_affinity auto;: Eliminates accept-queue contention across cores on multi-core Linux hosts by giving each worker its own kernel listen queue pinned to a CPU core.
  • Native io_uring & UDP GSO: naati automatically enables Linux io_uring (falling back to epoll where restricted) and UDP_SEGMENT (UDP GSO) for HTTP/3 without extra config directives.
  • Precompressed static assets: Pair brotli_static on; and gzip_static on; with pre-compressed .br / .gz assets to avoid per-request compression CPU overhead.
  • Upstream keepalive: Always pair keepalive 64; with proxy_http_version 1.1; proxy_set_header Connection ""; to eliminate per-request TCP handshake overhead to backends.
  • Container CPU limits: In Docker or Kubernetes with CPU quotas, set NAATI_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE=1 so worker count matches the cgroup quota rather than host physical cores.
  • Linux kernel sysctls for high connection counts:
sudo sysctl -w \
  net.core.somaxconn=65535 \
  net.ipv4.tcp_max_syn_backlog=65535 \
  net.ipv4.ip_local_port_range="1024 65535" \
  net.core.netdev_max_backlog=16384