Analyzer ngx-shdict-hit-rate

Name

ngx-shdict-hit-rate - Nginx Shared Dict Hit Rate

This analyzer monitors the cache hit rate of Nginx shared dictionary (shared memory zones) in OpenResty, Kong, and APISIX applications. It tracks cache hit and miss statistics, generating pie charts that visualize the distribution of cache access patterns. This helps evaluate cache effectiveness and identify opportunities for optimizing shared dictionary usage to improve application performance.

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-shdict-hit-rate -p PID

# trace a shell command directly
orxray analyzer run ngx-shdict-hit-rate -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-shdict-hit-rate -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run ngx-shdict-hit-rate --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Pie Charts
  • Plain Texts

Output Example

[
  {
      "title": "Nginx Shared Dicts Cache Hit Rate",
      "subtitle": "148 samples in total.",
      "type": "pie",
      "id": "",
      "series": {
          "data": {
              "Cache hit (expired)": 1,
              "Cache hit (no expired)": 123,
              "Cache missed": 24
          },
          "name": "Cache Hit Status",
          "valueUnit": "Calls"
      },
      "ver": 1,
      "kind": "ngx-shdict-hit-rate"
  },
  {
      "title": "Shared Dictionary hit rate",
      "type": "table",
      "ver": 1,
      "data": [
          [ //This is the title of the data
              "Dictionary",
              "Hit",
              "Expire",
              "Miss"
          ],
          [
              "\"lock\"",
              "0",
              "0",
              "15"
          ],
          [
              "\"upstream_healthy_check\"",
              "33",
              "1",
              "9"
          ],
          [
              "\"meta\"",
              "63",
              "0",
              "0"
          ],
          [
              "\"metrics\"",
              "15",
              "0",
              "0"
          ],
          [
              "\"ocsp\"",
              "10",
              "0",
              "0"
          ],
          [
              "\"dymetrics_keys\"",
              "2",
              "0",
              "0"
          ]
      ]
  }
]

Author

The OpenResty Inc. Team.

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