Analyzer lj-dump-loaded-mods
Name
lj-dump-loaded-mods - Showing the loaded modules of the LuaJIT VM
This analyzer inspects the memory footprint of LuaJIT-based applications by enumerating all loaded Lua modules within the LuaJIT VM. It captures module loading information from applications such as OpenResty, Kong, and APISIX, generating a bar chart that visualizes the loaded module inventory. This analyzer helps identify unnecessary module dependencies, detect memory bloat from excessive module loading, and optimize application startup time and memory consumption.
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 lj-dump-loaded-mods -p PID
# trace a shell command directly
orxray analyzer run lj-dump-loaded-mods -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run lj-dump-loaded-mods -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run lj-dump-loaded-mods --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Bar Charts
- Plain Texts
Output Example
[
{
"data": [
[ "module", "type", "version" ], // The title of the table
[ "resty.zlib", "table", "0.4.0" ],
[ "cjson", "table", "2.1.0.11" ],
[ "oredge.log", "table", "-" ]
],
"type": "table",
"title": "Loaded modules of the Lua VM"
}
]
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.