Why a slowdown turns into extra load
Audit retry settings layer by layer
| Layer | Where retries are configured | What to record |
|---|---|---|
| CDN or edge | Provider dashboard or origin settings | Retries on origin timeout, and the timeout value |
| Reverse proxy | Nginx or HAProxy config | Attempts per request, timeouts, which errors trigger a retry |
| Service mesh or sidecar | Route or retry policy objects | Retry count, per-try timeout |
| Application HTTP or DB client | Library config or code | Retry count, backoff, timeout |
| Third-party SDK | Library defaults | Whether it retries even when your code sets nothing |
nginx -T prints the full loaded config, including included files. On HAProxy, retries are set in defaults or backend sections.
BASH
# Nginx: which locations pass failed requests to another upstream, and with what limits
sudo nginx -T 2>/dev/null | grep -nE 'proxy_next_upstream|proxy_connect_timeout|proxy_read_timeout'
# HAProxy: retry count, retry conditions, and timeouts
grep -nE '^[[:space:]]*(retries|retry-on|option redispatch|timeout (connect|server))' /etc/haproxy/haproxy.cfgproxy_next_upstream controls the conditions under which Nginx sends a request to the next server in the upstream group. The documented default includes error and timeout, so a timeout against one backend sends the same request to the next one. proxy_next_upstream_tries caps the number of attempts. Its default of 0 means no cap other than the number of servers in the group. proxy_next_upstream_timeout limits the total time spent on attempts. If every server in an upstream group talks to the same slow database, Nginx will try each of them in turn.
Application clients have no universal command to check. Read the configuration for your HTTP client, database driver, and any vendor SDK, and note the retry count, the timeout, and whether backoff is enabled. Some SDKs retry by default even when your code sets nothing, so check the library documentation instead of assuming the count is zero.
Multiply the attempt counts you wrote down. The product is the worst-case number of attempts per user request.
Measure the real amplification from logs
X-Request-ID header, count how many times each ID appears at the dependency.
BASH
# Requests per minute (combined log format: field 4 holds the timestamp)
awk '{print substr($4, 2, 17)}' /var/log/nginx/access.log | sort | uniq -c | tail -n 20
# Request IDs seen more than once at the dependency (assumes the ID is the last field)
awk '{print NF}' /var/log/nginx/dependency-access.log | sort | uniq -c | awk '1 > 1' | sort -rn | head -n 20log_format. Adjust $NF to the field that holds your request ID. Any ID that appears more than once at the dependency belongs to a retried request, and the IDs with the highest counts show which path retries the most.
Reproduce the slowdown in staging before and after a change
tc with the netem queueing discipline can add delay to all traffic leaving an interface. Apply it on the dependency host so its responses arrive late.
Warning: netem applies to all traffic on the interface, including your SSH session if it uses the same interface. Use it only on a staging host that you can reach another way, such as a console or a second interface, and remove the rule when you finish. Never run it on production.
BASH
# Staging only: delay all outbound traffic on this interface by 2 seconds
sudo tc qdisc add dev eth0 root netem delay 2000ms
# From a separate client machine: send a fixed number of requests through the full stack
ab -n 1000 -c 50 'http://staging.example.com/api/orders'
# Back on the dependency host: remove the delay
sudo tc qdisc del dev eth0 rooteth0 with the real interface name, which you can find with ip link. Choose a delay longer than your client timeouts so that every attempt times out. Send a known number of requests (1,000 in this example), then use the log commands above to count how many reached the dependency. That count divided by 1,000 is your measured amplification. Change one setting, run the test again, and compare the two numbers.
Backoff, jitter, and retry budgets
non_idempotent. Confirm this for your version before relying on it.
