Analyzer ngx-shm-tree-height

Name

ngx-shm-tree-height - Compute the RBTree Height of Nginx Shared Memory Zones.

This analyzer computes the height of red-black trees used in Nginx shared memory zones within OpenResty, Kong, and APISIX applications. It captures the tree structure metrics to identify potential performance degradation caused by unbalanced trees. The analyzer generates bar charts showing the height distribution of RBTrees across different shared memory zones, helping diagnose memory access inefficiencies and optimize shared memory zone configurations.

Resource Category

Memory.

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-shm-tree-height -p PID

# trace a shell command directly
orxray analyzer run ngx-shm-tree-height -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Bar Charts
  • Plain Texts

Output Example

[
  {
      "title": "Compute the RBTree Height of Nginx Shared Memory Zones",
      "subtitle": "",
      "series": {
          "data": {
              "upstream_healthy_check_report": 3,
              "upstream_healthy_check": 5,
              "metrics": 4,
              "waf": 1,
              "ocsp": 2,
              "sysstat": 3,
              "dns_cache": 2,
              "limit_rate": 1,
              "proxycache": 15,
              "cached_metrics": 5,
              "dymetrics_keys": 5,
              "limit_req_shdict": 17,
              "ssl_session_cache": 13,
              "dynamic_metric_shdict": 1,
              "meta": 3
          },
          "name": "height"
      },
      "ver": 1,
      "type": "bar"
  }
]

Author

The OpenResty Inc. Team.

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