Analyzer openresty-compiled-regex-cache
Name
openresty-compiled-regex-cache - OpenResty Compiled Regex Cache Statistics
This analyzer monitors the compiled regular expression cache in OpenResty and Kong applications. It tracks cache hit rates, memory consumption, and pattern compilation statistics for PCRE-based regex operations used in Lua code (via ngx.re.* APIs). The analyzer outputs detailed statistics about match patterns, sub-patterns, and cache efficiency metrics, helping identify regex performance bottlenecks and optimize pattern matching operations. It shows both the total number of cached patterns and their actual content (base64 encoded for safety).
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 openresty-compiled-regex-cache -p PID
# trace a shell command directly
orxray analyzer run openresty-compiled-regex-cache -c SHELL_CMD
Tracing Multiple Processes
Not supported.
Output Formats
- Tables
- Plain Texts
Output Example
{
"kind": "lua-regex-config",
"max_regex_cache_size": "8192",
"match_regex_cache_count": "393",
"sub_regex_cache_count": "14",
"match-pattern": [
"base64:am86ICw=",
"base64:am86IFxzKw==",
"base64:am86IF5hcHA6KC4qKQ==",
"... (390 more patterns)"
],
"sub-pattern": [
"base64:am94czogIC9cKiBbXipdKlwqKyAoPzpbXi8qXVteKl0qXCorKSovIA==",
"base64:am86ICheXHMqfFxzKiQp",
"... (12 more patterns)"
]
}
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.