Analyzer ngx-http-upstream-time
Name
ngx-http-upstream-time - Nginx HTTP Upstream Latency
This analyzer profiles upstream request latency in Nginx-based applications such as OpenResty, Kong, and APISIX. It captures timing metrics for three critical phases: connection establishment time, response header time, and total response time. The analyzer produces histogram distributions for each phase, enabling identification of upstream server performance issues, network latency problems, and backend service bottlenecks.
Resource Category
Latency.
Application Type & Technical Stack
- OpenResty
- Kong
- APISIX
Command Line Syntax
The analyzer can be invoked directly on the command-line via the orxray
utility from the openresty-xray-cli software package.
Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).
# PID is the target process PID.
orxray analyzer run ngx-http-upstream-time -p PID
# trace a shell command directly
orxray analyzer run ngx-http-upstream-time -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-http-upstream-time -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run ngx-http-upstream-time --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Histogram Bar Charts
- Plain Texts
Output Example
{
"kind": "upstream-latency",
"data": {
"unit": "ms",
"summary": {
"resp-time": {"min": 16, "max": 200, "count": 25, "sum": 1162},
"header-time": {"min": 16, "max": 200, "count": 25, "sum": 1162},
"conn-time": {"min": 0, "max": 33, "count": 25, "sum": 213}
},
"distributions": {
"resp-time": [
{"key": "4", "count": 0},
{"key": "8", "count": 0},
{"key": "16", "count": 16},
{"key": "32", "count": 6},
{"key": "64", "count": 0},
{"key": "128", "count": 3},
{"key": "256", "count": 0},
{"key": "512", "count": 0}
],
"header-time": [
{"key": "4", "count": 0},
{"key": "8", "count": 0},
{"key": "16", "count": 16},
{"key": "32", "count": 6},
{"key": "64", "count": 0},
{"key": "128", "count": 3},
{"key": "256", "count": 0},
{"key": "512", "count": 0}
],
"conn-time": [
{"key": "0", "count": 18},
{"key": "1", "count": 0},
{"key": "2", "count": 0},
{"key": "4", "count": 0},
{"key": "8", "count": 0},
{"key": "16", "count": 5},
{"key": "32", "count": 2},
{"key": "64", "count": 0},
{"key": "128", "count": 0}
]
}
}
}
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.