# Static backend for the proxy benchmark. # # It exists only to answer three fixed bodies faster than either proxy in front # of it can ask, so that what gets measured is the proxy and not this. The # Python one it replaces topped out at 243 req/s on a 1 KB body — the 40 ms # delayed-ACK stall you get from writing headers and body as separate uncorked # sends — which would have capped both proxies at the same wrong number and # produced a comparison of nothing. # worker_processes 4; worker_cpu_affinity 0001 0010 0100 1000; # cores 0-3 = two physical cores; the proxy owns 4-5 error_log /root/bench/out/nginx-error.log crit; pid /root/bench/out/nginx.pid; daemon on; events { worker_connections 8192; multi_accept on; } http { access_log off; error_log /root/bench/out/nginx-error.log crit; # sendfile with tcp_nopush (TCP_CORK) held the last segment of about one # 64 KB response in three hundred for the peer's 40 ms delayed-ACK timer: # max request time 42 ms, sd 2.4 ms, with nothing in front of nginx at all. # Both proxies inherited it on every 64 KB backend fetch, and a fixed stall # costs the faster proxy proportionally more. With sendfile off the max is # ~2 ms, and every ceiling still sits far above either proxy (2026-09-25). sendfile off; tcp_nopush off; tcp_nodelay on; # the thing the Python backend lacked # An open()+fstat() per request is real work at 130k req/s, and the three # bodies never change. Caching the descriptors removes it from the ceiling # this file exists to stay clear of. open_file_cache max=16 inactive=1h; open_file_cache_valid 1h; open_file_cache_min_uses 1; open_file_cache_errors off; keepalive_timeout 120s; keepalive_requests 1000000; client_body_temp_path /root/bench/out/nginx-body; proxy_temp_path /root/bench/out/nginx-proxy; fastcgi_temp_path /root/bench/out/nginx-fcgi; uwsgi_temp_path /root/bench/out/nginx-uwsgi; scgi_temp_path /root/bench/out/nginx-scgi; server { listen 127.0.0.1:18080 backlog=16384 reuseport; server_name _; default_type application/octet-stream; root /srv/bench/www; # Served from memory after the first read; no per-request work beyond # the send itself. location = /empty { alias /srv/bench/www/empty.bin; } location = /1k { alias /srv/bench/www/1k.bin; } location = /64k { alias /srv/bench/www/64k.bin; } location = /status { stub_status; } location / { return 404; } } }