How to Break Down Nginx Latency Into Four Parts to Find Hidden Slowdowns
Nginx's default $request_time metric collapses all phases of a request into a single number, making it difficult to pinpoint where slowdowns actually occur. This means issues like slow upstream connections, backend processing delays, or TLS overhead can remain invisible even when aggregate metrics like p95 appear healthy. To get a granular view, engineers must configure a custom log_format in nginx that includes $upstream_connect_time, $upstream_header_time, and $upstream_response_time alongside $request_time. Once this custom format is applied and nginx is reloaded, latency can be broken into four distinct phases by subtracting these timestamps from one another. Notably, any log entries written before the configuration reload will lack these fields, so historical analysis is not possible without this setup in place.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in