DevOps
DevOpsIntermediate

Caddy vs. NGINX vs. Traefik: Docker Production Benchmark & Config Guide

Hands-on Docker benchmark comparing Caddy 2, NGINX, and Traefik v3 under HTTPS, cold TLS handshakes, memory load, and zero-downtime SSE reloads.

Cover image: Caddy vs. NGINX vs. Traefik: Docker Production Benchmark & Config Guide
Contents

Every containerized production stack hits the same crossroads right after you get your app and database running safely: what sits on ports 80 and 443 in front of them?

In production, reverse proxy outages rarely happen because a proxy “wasn’t fast enough.” They happen at 3:00 a.m. when a Certbot cron hook silently fails to reload NGINX, when an unbuffered nginx -s reload kills long-lived Server-Sent Events, or when someone copies a 90-line Traefik Docker label block and breaks routing across three containers.

The short verdict. NGINX is still the raw throughput king (17,743 req/s), Caddy is the operational sweet spot (13,358 req/s, 35.7 MiB active RAM, 13-line config with built-in auto-HTTPS), and Traefik wins when containers spin up and down dynamically via Docker labels — at the cost of 4.5× more RAM under load.

Caddy vs NGINX vs Traefik: Docker TLS, k6 Throughput, RAM & Zero-Downtime Reloads

If you already locked down your database layer (see PostgreSQL in Docker for Production), choosing the right Docker reverse proxy is the next structural decision. Instead of repeating decade-old “NGINX uses 10 MB and is 30% faster” folklore, we built a reproducible container benchmark and measured all three head-to-head.

Architecture: Three Proxies, Three Complexity Budgets

Before looking at requests per second, look at what each proxy actually asks you to maintain for the exact same production baseline (HTTPS + gzip/zstd + security headers + upstream keep-alive):

Caddy vs NGINX vs Traefik operational architecture in Docker: Caddyfile auto-HTTPS vs NGINX external Certbot vs Traefik dynamic providers
Caddy folds TLS automation into a 13-line Caddyfile, NGINX separates TLS renewal into external Certbot tooling, and Traefik splits static entrypoints from dynamic labels or files.
Architecture: Three Proxies, Three Complexity Budgets
Dimension Caddy 2 (2.11.9) NGINX (1.31.10) Traefik v3 (3.8.0)
Core Engine Go (net/http + crypto/tls) C event loop (epoll + OpenSSL) Go (net/http + crypto/tls)
Config Footprint (Equivalent Setup) 13 lines (Caddyfile) 39 lines (nginx.conf) 38 lines (traefik.yml + dynamic.yml)
Automatic HTTPS (Let’s Encrypt) Built-in & default (ACME + OCSP) Manual (Certbot sidecar + cron + reload) Built-in (HTTP-01 / TLS-ALPN-01 / DNS-01)
HTTP/3 (QUIC) Enabled by default Manual quic listener + UDP config Opt-in http3 entrypoint flag
Dynamic Docker Discovery Manual Caddyfile (or caddy-docker-proxy plugin) Requires external nginx-proxy / docker-gen Native (providers.docker labels)
Config Reload Mechanism Atomic caddy reload via :2019 Admin API nginx -s reload (spawns new workers) Automatic file/socket watcher (watch: true)

Notice the trap in the NGINX column: those 39 lines do not even include TLS certificate issuance or renewal. To match Caddy’s automatic HTTPS, NGINX needs an extra Certbot container, a shared ACME challenge volume, and a reload trigger.

Real Docker k6 Benchmark: Throughput, Cold TLS & RAM

To eliminate host port-forwarding overhead and get clean numbers, all three proxies ran sequentially inside the same isolated Docker bridge network (rp-bench-net, --cpus=2 --memory=512m) in front of an identical Node.js 24 HTTP/SSE upstream (--cpus=2 --memory=256m), driven from inside the same network by Grafana k6 v2.4.0 (see Grafana k6 vs. Apache JMeter for why k6 avoids generator bottlenecks).

Caddy vs NGINX vs Traefik k6 benchmark results: warm HTTPS throughput, cold TLS p95 latency, container RAM under load, and zero-downtime reload
NGINX leads raw warm throughput (17,743 req/s), while Caddy uses the least active RAM (35.7 MiB) and avoids OpenSSL cold-TLS tail spikes.
Real Docker k6 Benchmark: Throughput, Cold TLS & RAM
Benchmark Metric (2 vCPU / 512 MiB Cap) Caddy 2.11.9 NGINX 1.31.10 Traefik 3.8.0
Idle Container RAM (docker stats) 19.2 MiB 40.0 MiB 22.3 MiB
Active RAM Under 50-VU Load 35.7 MiB 50.6 MiB 160.0 MiB
Warm HTTPS + gzip (50 VUs, 15s) 13,358 req/s 17,743 req/s 14,646 req/s
Warm Latency (med / p95) 3.41 ms / 7.02 ms 1.17 ms / 3.09 ms 3.21 ms / 5.53 ms
Cold TLS Handshakes (25 VUs, no reuse) 1,181 req/s 1,681 req/s 1,196 req/s
Cold TLS Latency (med / p95) 11.26 ms / 24.13 ms 1.36 ms / 68.33 ms 10.78 ms / 23.44 ms
Zero-Downtime Reload (20 VUs + 5s SSE) 0 drops · 25/25 ticks 0 drops · 25/25 ticks 0 drops · 25/25 ticks

Three real-world findings jump straight out of those numbers:

  1. The “NGINX uses 10 MB RAM” myth breaks on modern Docker hosts. Because nginx:alpine enables worker_processes auto by default, NGINX spawns one worker per visible CPU core. On a multi-core host, idle NGINX started at 40.0 MiB — 2× higher than Caddy (19.2 MiB) and Traefik (22.3 MiB).
  2. Traefik’s RAM jumps 7× under real traffic. At idle, Traefik looks lean (22.3 MiB). Under 50 concurrent virtual users, its active footprint jumped to 160.0 MiB (4.5× Caddy’s 35.7 MiB). On a 4 GB cloud VM that is irrelevant; on a 512 MB–1 GB micro-VPS sharing space with Postgres and an app container, it matters.
  3. Cold TLS tail latency favors Go under burst. NGINX pushed the highest average cold-TLS rate (1,681 req/s), yet its p95 tail spiked to 68.33 ms when 25 VUs hammered fresh RSA-2048 handshakes simultaneously. Both Go proxies (Traefik 23.44 ms, Caddy 24.13 ms) kept tail latency nearly 2.8× tighter.

Zero-Downtime Config Reloads & SSE/WebSocket Traps

In Scenario C, we drove 20 VUs of continuous HTTPS traffic while holding open a 5-second Server-Sent Events (/stream, 25 ticks) connection, and triggered a live config swap (X-Proxy-Gen: v1 → v2) mid-stream:

  • Caddy (caddy reload): Swapped cleanly to v2, 0 failed HTTP requests, 25/25 SSE ticks delivered. Because Caddy validates the config over its local :2019 Admin API before applying, a broken Caddyfile is rejected atomically without touching live traffic.
  • NGINX (nginx -s reload): Also delivered 0 failed requests and 25/25 SSE ticks — because old worker processes stay alive until their existing long-lived connections close.
  • Traefik (watch: true / Docker socket): Updated dynamically to v2 with 0 dropped requests and 25/25 SSE ticks without any reload command. Watch out for one edge case: on network filesystems or editors that use atomic rename() swaps, verify watch: true detects the inode change in your container mount.

Copy-Paste Production Configs Compared

Nothing explains the ergonomics gap faster than seeing the exact files side by side for the same production setup (HTTPS, zstd/gzip, HSTS + nosniff, and streaming-safe proxying):

1. Caddy (Caddyfile — 9 lines with Auto-HTTPS)

Replace :8443 + manual cert paths with your domain name and Caddy handles Let’s Encrypt, HTTP→HTTPS redirects, OCSP stapling, and HTTP/3 automatically:

Caddyfile
api.example.com {
encode zstd gzip
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
}
reverse_proxy app:8080 {
flush_interval -1
}
}

2. NGINX (nginx.conf — 39 lines, excluding Certbot)

Notice the required Connection "" header reset for upstream keepalive 64, always on add_header (otherwise NGINX drops security headers on 4xx/5xx responses), and proxy_buffering off for SSE:

nginx.conf
worker_processes auto;
events { worker_connections 4096; }
http {
sendfile on;
gzip on;
gzip_types application/json text/plain text/css application/javascript;
upstream backend {
server app:8080;
keepalive 64;
}
server {
listen 443 ssl;
http2 on;
server_name api.example.com;
ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
location / {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
}

3. Traefik v3 (compose.yaml Docker Labels)

Traefik shines when you never want to edit a central proxy file as new microservices join your compose.yaml:

compose.yaml
services:
app:
image: my-api:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.app.rule=Host(`api.example.com`)"
- "traefik.http.routers.app.entrypoints=websecure"
- "traefik.http.routers.app.tls.certresolver=letsencrypt"
- "traefik.http.routers.app.middlewares=sec-headers,gzip-compress"
- "traefik.http.services.app.loadbalancer.server.port=8080"

4 Production Traps That Break After Launch

Benchmarks test happy-path JSON responses. Real outages happen on uploads, CDN headers, idle streams, and brute-force spikes:

4 Production Traps That Break After Launch
Production Trap Caddy 2 NGINX Traefik v3
Large file uploads (413 error) Unlimited by default (cap with request_body) Defaults to 1 MB (client_max_body_size 1m) — breaks uploads silently Unlimited by default (buffering middleware optional)
Built-in Rate Limiting Requires plugin (xcaddy + caddy-ratelimit) Built-in (limit_req_zone / limit_req) Built-in (rateLimit middleware)
Idle WebSocket / SSE timeout No hard 60s cut unless configured Drops idle streams after 60s (proxy_read_timeout) respondingTimeouts.idleTimeout (180s default)
Real Client IP behind Cloudflare trusted_proxies cloudflare / CIDR block set_real_ip_from + real_ip_header CF-Connecting-IP entryPoints.websecure.forwardedHeaders.trustedIPs

Two of these catch teams off guard every single week:

  1. The NGINX 1 MB upload cliff (413 Request Entity Too Large): Everything works in local tests with tiny JSON payloads. Ten minutes after launch, the first user uploads a 2 MB avatar or PDF and NGINX rejects it before your backend ever sees the request. Always set client_max_body_size 25m; (or your app’s exact ceiling) explicitly in nginx.conf.
  2. Rate limiting without xcaddy: This is Caddy’s main batteries-not-included trade-off. NGINX (limit_req_zone) and Traefik (rateLimit middleware) ship rate limiting out of the box; standard Caddy requires building a custom binary with xcaddy and caddy-ratelimit (or placing Cloudflare / app-level rate limiting in front). If strict per-IP edge throttling in a stock Docker image is a hard requirement, NGINX or Traefik saves a custom Dockerfile.

What About Nginx Proxy Manager and Kubernetes Gateway API?

Two questions come up on almost every Caddy vs NGINX vs Traefik thread:

Decision matrix for Caddy vs NGINX vs Traefik plus Nginx Proxy Manager and Kubernetes Gateway API
Pick Caddy for Docker Compose simplicity, NGINX for edge throughput, Traefik for dynamic labels — and plan Gateway API if moving to Kubernetes.
  1. Caddy vs. Nginx Proxy Manager (NPM): NPM wraps NGINX + Certbot behind a friendly web dashboard. For a homelab or a team that prefers click-ops over Git commits, NPM is fast to set up. For production engineering teams, Caddy wins on reproducibility: a 10-line Caddyfile lives in Git, passes PR review, and deploys identically across staging and production without SQLite state inside a GUI container.

  2. Moving from Docker Compose to k3s / Kubernetes? Make sure you do not confuse two different projects:

    • NGINX itself (nginx:alpine in Docker) is not deprecated — it remains actively maintained.
    • Kubernetes ingress-nginx (kubernetes/ingress-nginx) is retired as of March 2026 (archived and read-only, with no further CVE patches).

    If you plan to outgrow a single Docker host, do not invest in legacy nginx.ingress.kubernetes.io/* annotations. Traefik v3 already implements Kubernetes Gateway API natively alongside Docker Compose, making it the smoothest transition path (see k3s vs. k0s vs. MicroK8s vs. RKE2 when picking your lightweight cluster).

30-Second Production Choice Checklist

  • Choose Caddy if you run a single VPS or Docker Compose stack, want 10-line configs + automatic HTTPS + HTTP/3, and value 35.7 MiB active RAM with zero Certbot maintenance.
  • Choose NGINX if you need maximum raw throughput (17.7k+ req/s on 2 vCPU), heavy static caching, custom Lua/WAF modules, or already run hardened NGINX CI pipelines.
  • Choose Traefik if containers frequently spin up and down via Docker labels, you want built-in middleware chains and a routing dashboard, and 160 MiB active RAM fits comfortably in your host budget.

Frequently asked questions

Is Caddy fast enough to replace NGINX as a Docker reverse proxy in production?

Yes for almost every web application and API. In our 2-vCPU Docker k6 benchmark, Caddy handled 13,358 req/s with 0% errors and 3.41 ms median latency while using just 35.7 MiB of RAM. Unless your single edge node pushes extreme static throughput or relies on custom C/Lua NGINX modules, your database or application code will bottleneck long before Caddy.

Why did Traefik use 160 MiB of RAM under load while Caddy used 35.7 MiB?

At idle, Traefik and Caddy look nearly identical (22.3 MiB vs. 19.2 MiB). Under 50 concurrent virtual users, Traefik's router evaluation, middleware chain allocations, and Go garbage-collector headroom expanded to 160.0 MiB, whereas Caddy stayed at 35.7 MiB. That does not matter on a 4 GB host, but it matters on a tight 512 MB–1 GB VPS.

What breaks first with NGINX vs. Caddy when automating Let's Encrypt in Docker?

NGINX has no built-in ACME client. You either mount a shared webroot and run Certbot in a sidecar with cron reload hooks, or write custom scripts. When a DNS change, rate limit, or reload cron fails silently, certificates expire at 3 a.m. Caddy automates ACME issuance, OCSP stapling, and zero-downtime renewal inside the same binary.

When should I choose Nginx Proxy Manager instead of raw Caddy, NGINX, or Traefik?

Pick Nginx Proxy Manager (NPM) when a small team or homelab operator wants a web GUI for point-and-click hosts and Let's Encrypt certificates without editing config files. Avoid NPM in production pipelines where you need clean Git pull-request diffs, reproducible CI validation, or infrastructure-as-code.

How do Caddy, NGINX, and Traefik compare if I plan to migrate from Docker Compose to Kubernetes or k3s?

Kubernetes ingress-nginx (kubernetes/ingress-nginx) retired in March 2026 with no further CVE patches, though NGINX itself in Docker remains actively maintained. New Kubernetes clusters standardize on Gateway API: Traefik v3 already ships native Gateway API support alongside Docker labels, making it the smoothest transition path, while Cilium and Envoy Gateway lead Kubernetes-native deployments.

From the community

Discussion on Mastodon & Bluesky

Replies to this article from the open web, pulled in live. No ads, no tracking scripts.

Loading replies …
Reply on MastodonReply on Bluesky

Reply there — it shows up here automatically.

ENDE