Analyzer ngx-timer-delay-distr

Name

ngx-timer-delay-distr - Timeout Value Distribution of Nginx Timer

This dynamic tracing analyzer captures and analyzes the distribution of timeout values used when creating timers at runtime in OpenResty and Kong applications. It intercepts ngx.timer.at and ngx.timer.every calls to collect delay values, then generates histogram visualizations showing the frequency distribution across different timeout ranges. This helps identify timer usage patterns, detect abnormal timeout configurations, and optimize timer scheduling strategies in production environments.

Resource Category

CPU.

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-timer-delay-distr -p PID

# trace a shell command directly
orxray analyzer run ngx-timer-delay-distr -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-timer-delay-distr -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run ngx-timer-delay-distr --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Histogram Bar Charts
  • Plain Texts

Output Example

[{
  "title": "Timer Distribution of nginx add timer event",
  "subtitle": "927 Calls (min: 1 ms, avg: 263287 ms, max: 600000 ms)",
  "type": "dist-bar",
  "ver": 1,
  "series": {
    "data": {
      "0": 0, "1": 6, "2": 6, "4": 21, "8": 9, "16": 2, "32": 19,
      "64": 153, "128": 0, "256": 0, "512": 25, "1024": 8, "2048": 0,
      "4096": 23, "8192": 3, "16384": 1, "32768": 242, "65536": 30,
      "131072": 1, "262144": 0, "524288": 378, "1048576": 0, "2097152": 0
    },
    "categoryTitle": "Timer Distribution",
    "categoryUnit": "ms",
    "name": "Calls"
  },
  "summary": {"min": 1, "max": 600000, "avg": 263287, "cnt": 927},
  "kind": "ngx-timer-delay-distr"
}]

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.