Analyzer ngx-lua-sleep
Name
ngx-lua-sleep - Nginx Lua Sleep Calls Distribution
This analyzer monitors the distribution of sleep call durations in Nginx Lua applications such as OpenResty, Kong, and APISIX. It captures timing data for ngx.sleep() invocations across the application, tracking both the frequency and duration of sleep operations. The analyzer generates histogram visualizations that reveal sleep patterns and potential blocking issues, helping identify unnecessary delays and optimize request processing latency.
Resource Category
Miscellaneous.
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-lua-sleep -p PID
# trace a shell command directly
orxray analyzer run ngx-lua-sleep -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-lua-sleep -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run ngx-lua-sleep --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Histogram Bar Charts
- Plain Texts
Output Example
[
{
"title": "Nginx Lua Sleep Calls Distribution",
"subtitle": "12 Calls (min: 12 ms, avg: 39 ms, max: 91 ms)",
"kind": "ngx-lua-sleep",
"summary": {
"min": 12,
"max": 91,
"avg": 39,
"cnt": 12
},
"type": "dist-bar",
"ver": 1,
"series": {
"data": {
"64": 2,
"128": 0,
"256": 0,
"4": 0,
"32": 2,
"2": 0,
"16": 6,
"8": 2
},
"name": "Calls",
"categoryUnit": "ms",
"categoryTitle": "Blocking Time"
}
}
]
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.