Analyzer ngx-lua-code-cache

Name

ngx-lua-code-cache - Nginx Lua Code Cache Requests

This analyzer monitors Lua code cache behavior in OpenResty and Kong applications. It tracks whether lua_code_cache is enabled or disabled by counting requests that trigger Lua code recompilation. When lua_code_cache is off (typically in development), every request recompiles Lua code, causing significant performance overhead. This analyzer helps identify misconfigured production environments and quantifies the performance impact of disabled code caching.

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-lua-code-cache -p PID

# trace a shell command directly
orxray analyzer run ngx-lua-code-cache -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Plain Texts

Output Example

[{
  "title": "Nginx Lua Code Cache Requests",
  "subtitle": "",
  "series": {
    "data": {
      "Cache Off Requests": 0,
      "Lua Requests": 65
    },
    "name": "Count"
  },
  "ver": 1,
  "type": "bar"
}]

Author

The OpenResty Inc. Team.

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