nginx Reload vs Restart: What Actually Happens to In-Flight Requests
A reload dropped zero requests in three loops of about 26,000 each, with the longest pause 0.040 seconds. A restart dropped about 4,000 connection attempts per loop and left a 0.22-second hole. A slow download finished through a reload and through a graceful quit, and was cut to 39.1 percent by a stop. A bad config is refused by a reload and cannot even stop the server, while a true restart with a broken config never comes back. Here are the counts.
Written November 8, 2026 · Tested with nginx 1.24.0 · 13 min read
- Reload drops nothing; restart drops about 4,000 attempts
- The restart hole is 0.22 seconds, not 4,000 seconds
- A slow download survives a reload and a quit, not a stop
- A bad config cannot break a running server — but it can stop a restart
dpkg-deb -x and run as an unprivileged user on 127.0.0.1:18080, two workers, OpenSSL 3.0.13. There is no system nginx install, so the binary runs from the extracted package with a private prefix.What this guide is
This guide counts what happens to in-flight requests when nginx reloads its configuration and when it restarts. It does not teach nginx configuration syntax. The nginx server-block auditor tool on this site already checks a pasted server block against the documented rules for proxy headers, WebSocket upgrades, TLS, and inheritance. This guide runs the server and counts what happens: how many requests a reload drops, how many a restart drops, how long the hole lasts, what happens to a download already in progress, and what a bad config does under each order.
The numbers in this guide are the fresh ones. The 2026-11-07 figures are quoted alongside wherever they differ, and no number is carried forward without re-execution.
The nearest existing piece is a November 2026 Docker deployment guide that claims a reload swaps workers "in under 5 milliseconds with zero dropped connections" and puts restart downtime at "30 to 90 seconds of 502/404 errors" against reload at "0 milliseconds (0 dropped requests)". Its restart side is a Docker container restart, where health checks and DNS re-registration take 30 to 90 seconds to recover, and its only counted run is 64 requests at 10 per second during a deploy. It never measures the nginx process restart itself, and it never counts a client loop. This guide measures the process restart: stop plus start, no container, no proxy, no CDN, with every request counted.
The setup
The probe runs nginx 1.24.0 (Ubuntu), extracted from the Ubuntu package with dpkg-deb -x and run as an unprivileged user on 127.0.0.1:18080, two workers, OpenSSL 3.0.13. There is no system nginx install, so the binary runs from the extracted package with a private prefix. The client is a Python loop that opens a fresh connection for each request, sends a sequential GET /, and runs for 6 seconds per repetition, with the action taken at t=2 seconds. The server answers each request with a marker string, MARKER-V1 or MARKER-V2, so the loop can see which configuration served each request. The restart measured here is nginx -s stop followed by starting nginx again, which is the same stop-then-start shape as a service restart.
nginx -p /home/user/nginx-probe-2026-11-07/run -c conf/nginx.conf -s reload
nginx -p /home/user/nginx-probe-2026-11-07/run -c conf/nginx.conf -s stop
Two probe details matter for reading the numbers. The Ubuntu binary's compiled-in temp paths point at /var/lib/nginx, which does not exist for an unprivileged user, so the probe config sets every temp path under its own prefix. And the slow-download test serves a 5,242,880-byte file with limit_rate 500k, which stretches the download to about 10 seconds so the action lands mid-transfer at t=3 seconds.
Reload drops nothing; restart drops about 4,000 attempts
Each reload repetition flips the marker, so the loop sees both the old and the new configuration inside one run. The master process stays the same across all three reloads; only the workers are replaced.
| Rep | Requests | 200 OK | Max pause | Slowest (ms) |
|---|---|---|---|---|
| 1 | 26,607 | 26,607 | 0.040 seconds | 39.80 |
| 2 | 26,058 | 26,058 | 0.040 seconds | 39.88 |
| 3 | 25,620 | 25,620 | 0.040 seconds | 39.93 |
| Median | 26,058 | 26,058 | 0.040 seconds | 39.88 |
Errors were zero in all three repetitions.
The master PID was 549541 before the first reload and 549541 after the third. The workers were replaced each time. Every loop saw both markers, so the new configuration served requests mid-loop while the old workers drained. The 2026-11-07 probe agrees: 26,243 requests at the median, zero errors, a 0.039-second longest pause, and a 39.29-millisecond slowest request.
The restart repetitions stop the server and start it again with the same configuration. A new master process starts each time.
| Rep | Attempts | Refused | Max pause | Slowest (ms) |
|---|---|---|---|---|
| 1 | 29,603 | 4,047 | 0.220 seconds | 40.03 |
| 2 | 29,652 | 4,037 | 0.233 seconds | 39.86 |
| 3 | 29,826 | 4,006 | 0.224 seconds | 1.23 |
| Median | 29,652 | 4,037 | 0.224 seconds | 39.86 |
Successful responses were 25,555, 25,614, and 25,819, a median of 25,614. One connection was reset in each repetition, on top of the refused counts. The 2026-11-07 probe agrees: a median of 3,945 refused attempts, a 0.220-second longest pause, and a 0.237-second stop-to-serving wall. The fresh run's stop-to-serving wall was 0.236, 0.250, and 0.240 seconds, a median of 0.240 seconds.
The restart hole is 0.22 seconds, not 4,000 seconds
The two restart numbers need to be read together, because either one alone misleads. About 4,000 attempts were refused per loop, but the client-visible downtime is the 0.22-second longest pause between successful responses, not 4,000 seconds of outage. The totals run higher in the restart loops than in the reload loops because a refused connection returns almost instantly, so the loop attempts faster during the dead window: roughly 4,000 refused attempts inside a 0.22-second hole is about 18,000 attempts per second. The hole is the time the server is down. The refused count is how many attempts piled into it at this client's speed.
The mechanism is what the nginx.org control page describes: a reload sends HUP to the master, which checks the syntax, starts new workers with the new configuration, and asks the old workers to shut down gracefully, while the old workers "close listen sockets and continue to service old clients". A stop sends TERM, which is a fast shutdown: the workers terminate immediately, the listen socket closes, and nothing answers until the new master starts and binds. The measured 0.240-second stop-to-serving wall matches the 0.224-second client-visible pause; the extra few hundredths are the loop's own timing.
A slow download survives a reload and a quit, not a stop
The slow test downloads a 5,242,880-byte file at 500 kilobytes per second, so the transfer takes about 10 seconds. The action happens 3 seconds in, with about 1.5 MB already received.
| Action mid-download | Received at t=3 seconds | curl result | Bytes received | Outcome |
|---|---|---|---|---|
reload (twice) |
1,531,904 | rc 0 | 5,242,880 (100%) | Completes |
stop + start |
1,536,000 | rc 18 | 2,048,000 (39.1%) | Cut off mid-transfer |
quit + start |
1,531,904 | rc 0 | 5,242,880 (100%) | Completes |
The reload case ran twice, flipping the marker out and back, and the download still completed. The quit case is the graceful shutdown: the old workers finish their active requests before exiting, so the download drains and the new server takes over new connections. The stop case cut the download at 2,048,000 bytes, which is more than the 1,536,000 bytes received at t=3 seconds, because 512,000 bytes already buffered in flight arrived before the connection died. The reported figure is the measured 2,048,000, not the 1.5 MB mark. The 2026-11-07 probe measured the identical three outcomes, byte for byte.
The distinction matters because quit plus start is a different restart from stop plus start. The request-loop restart above is the stop shape, which is what a service restart does. A graceful restart costs the same process start time but does not cut in-flight downloads. This guide measured quit plus start only for the slow download, not for the request loop, so no loop numbers are claimed for it.
A bad config cannot break a running server — but it can stop a restart
The bad config is one dropped semicolon: return 200 "MARKER-V1\n" without the ;. Under a reload, nginx refuses it and keeps serving the old configuration.
2026/11/08 09:21:51 [emerg] 549705#549705: unexpected "}" in /home/user/nginx-probe-2026-11-07/run/conf/nginx.conf:19
nginx: configuration file /home/user/nginx-probe-2026-11-07/run/conf/nginx.conf test failed
nginx -t (broken) rc=1
reload (broken) rc=1
marker still served: MARKER-V2
CLIENT total=8828 ok200=8828 errors={} max_lat_ms=1.24 max_gap_s=0.001 markers=['MARKER-V2']
The master and both workers were unchanged, the old configuration kept serving, and a 2-second client loop during the refusal lost zero requests out of 8,828. That is exactly the rollback the nginx.org page promises: "If this fails, it rolls back changes and continues to work with old configuration."
The restart case has two orders, and they behave differently. The first order, breaking the config and then trying to stop, never stops the server at all:
2026/11/08 09:21:52 [emerg] 549713#549713: unexpected "}" in /home/user/nginx-probe-2026-11-07/run/conf/nginx.conf:19
-s stop rc=1
port check after stop: 200 curl_rc=0
The -s path parses the configuration before signaling the master, so a broken config file cannot even stop the server that way. The master keeps running and the port still answers 200. To stop it you must fix the file first or kill the master PID directly.
The second order is the true restart: stop while the config is good, then break the config, then start.
-s stop (good conf) rc=0
(no nginx procs)
port after stop: 000 curl_rc=7
2026/11/08 09:22:36 [emerg] 550395#550395: unexpected "}" in /home/user/nginx-probe-2026-11-07/run/conf/nginx.conf:19
start (broken) rc=1
(no nginx procs)
port after broken start: 000 curl_rc=7
The server does not come back until the config is fixed. Restoring the good config and starting again returned rc 0 and the marker served. The 2026-11-07 correction run measured the same sequence: stop rc 0, port dead, start rc 1, port dead, restore and serve.
The practical rule follows from the two orders, not from either one alone. A reload with a broken config is safe: the old config keeps serving. A restart with a broken config is not: the server is down and stays down. And a broken config can hide behind a running server, because the reload refusal leaves the old workers in place and nothing visibly fails until the next full restart. Test with nginx -t before reloading, and before restarting most of all.
What this guide does not cover
The probe is HTTP/1.1, plain, with no TLS, no upstream, and no WebSocket or other long-lived connections. The loop opened a fresh connection per request; keepalive drain behavior was not measured. Do not apply these numbers to HTTP/3: a separate, measured QUIC bug makes about half of new HTTP/3 connections fail after a reload on unpatched nginx, while a full restart passes 20 of 20. That bug is a different fact from the numbers above, and it runs in the opposite direction — reload worse than restart — so the reload-is-safe direction here is an HTTP/1.1 result only.
The slowest requests, 39 to 40 milliseconds, are unexplained single-request delays. This guide reports the table, not a smoothed "no delay" claim, and offers no theory for the spike.
The restart measured is stop plus start, the service-restart shape. The numbers are per box and per network: loopback, two workers, an idle box. The 0.22-second restart hole scales with process start time, not with traffic. The zero-drop reload result is the direction that generalizes; the exact millisecond figures do not.
The probe ran as an unprivileged user with a package-extracted binary, not a system install. The systemctl reload and systemctl restart commands were not executed, so this guide shows nginx -s only and scopes its claims to that interface. The service-manager commands are the same operations through a different caller, but they were not run here and are not presented as run.
Checklist
- Before changing a config on a live server, test it first:
nginx -tcatches the broken file while the old workers are still serving. - Before choosing reload or restart, check what is at stake: a reload drops nothing in the loop and lets a slow download finish; a restart leaves a hole of about 0.22 seconds and cuts a download in progress to 39.1 percent.
- Before restarting, check the config is good: a reload with a broken config is safe, but a restart with a broken config leaves the server down until the file is fixed.
- Before stopping a server with a broken config file, check the file first:
nginx -s stopparses the config and refuses with rc 1, so the master keeps running and the port still answers. - Before trusting a "zero downtime" claim, check what was restarted: a Docker container restart costs 30 to 90 seconds of proxy and DNS recovery, while the nginx process restart itself costs about 0.22 seconds. They are different restarts.
- Before applying these numbers to HTTP/3, check the QUIC reload bug: about half of new QUIC connections fail after a reload on unpatched nginx, so the HTTP/1.1 numbers here do not transfer.
Related guides on this site
- cgroup v2 CPU Quota: What Actually Happens When the Throttle Bites, Measured
- systemd Timers vs Cron: What Actually Happens When a Run Is Missed
- cgroup v2 MemoryMax: What Actually Happens When a Process Hits the Limit, Measured
- How Fast Does systemd Restart a Crashed Service? Restart=always vs on-failure, Measured — and the Crash Loop It Refuses
Sources
- nginx, Controlling nginx — the mechanism primary, read fresh 2026-11-08: HUP "first checks the syntax validity, then tries to apply new configuration … If this fails, it rolls back changes and continues to work with old configuration"; old workers "close listen sockets and continue to service old clients"; TERM and INT are fast shutdown, QUIT is graceful shutdown, HUP starts new workers with the new configuration.
- Linuxize, Nginx Commands You Should Know — read in full 2026-11-08: "A restart is a quick stop followed by a start";
nginx -s reloadis "the same assystemctl reload nginx";nginx -s stopis fast shutdown,nginx -s quitis graceful shutdown; "Reloading with a broken config leaves the old workers running and masks the problem until the next full restart." - techloverhd, Zero-Downtime Docker Nginx Deploys: Fix 502 Errors (2026) — the nearest existing piece, opened in full 2026-11-08: reload "swaps worker processes in under 5 milliseconds with zero dropped connections", "Measured Downtime" table restart "30 to 90 seconds of 502/404 errors" vs reload "0 milliseconds (0 dropped requests)", benchmark 64 requests at 10 per second during a deploy, 100.0 percent uptime. Its restart side is a Docker container restart (health-check and DNS re-registration recovery), not the nginx process restart; no client loop counts the process restart.
- getpagespeed, NGINX HTTP/3 Is Broken After Reload — a separate measured fact, not this probe: about half of new QUIC connections fail after a reload on unpatched nginx (10 of 20 vs 20 of 20 after restart), a QUIC socket bug with a vendor patch. Cited so the HTTP/1.1 numbers above are not read as HTTP/3 numbers.
- nginx Server-Block Auditor — the companion tool on this site: a client-side static checker for a pasted server block, covering proxy headers, WebSocket upgrades, TLS, and inheritance. This guide measures process lifecycle; it re-teaches none of the auditor's static checks.
Keep Exploring
Paste a [Service] section and get a plain-language verdict on every sandboxing setting it finds.
Paste sshd -G output and get a hardening verdict on the values your server actually runs.
Paste a server block and get WebSocket, TLS, HSTS, and proxy-header verdicts.
Paste a systemd timer expression and get the specific reason it fails, the normalized form, and the past-date traps the built-in check hides.
The full sysadmin hub \u2014 systemd, cgroups, file tools, and measured Linux comparisons.