Analyzer ngx-shm-lru
Name
ngx-shm-lru - Nginx Share Memory LRU Statistics
This analyzer samples entries from the LRU (Least Recently Used) queue in Nginx shared memory zones and analyzes their characteristics. It collects two key metrics: entry size distribution and expiration time distribution. By sampling from either the head (most recently used) or tail (least recently used) of the LRU queue, it helps identify memory usage patterns, cache efficiency, and potential issues with expiring entries. Supports lua_shared_dict, limit_req, proxy_cache, fastcgi_cache, scgi_cache, and SSL session cache.
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-lru -p PID
# trace a shell command directly
orxray analyzer run ngx-shm-lru -c SHELL_CMD
Tracing Multiple Processes
Not supported.
Output Formats
- Histogram Bar Charts
- Plain Texts
Output Example
[{
"title": "Nginx shared dictionary entries sizes distribution",
"subtitle": "1 entries (min: 93 bytes, avg: 93 bytes, max: 93 bytes)",
"type": "dist-bar",
"ver": 1,
"series": {
"data": {"16": 0, "32": 0, "64": 1, "128": 0},
"name": "entries",
"categoryUnit": "bytes",
"categoryTitle": "entries"
},
"summary": {"min": 93, "avg": 93, "max": 93, "cnt": 1},
"kind": "ngx-shm-lru"
}]
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.