Analyzer lj-str-find-no-plain-fgraph

Name

lj-str-find-no-plain-fgraph - Lua string.find Searching Plain String Without Plain Mode Set

This analyzer detects inefficient usage of Lua’s string.find function where plain string searches are performed without enabling plain mode in LuaJIT-based applications such as OpenResty and Kong. It captures stack traces of function calls that trigger unnecessary pattern matching overhead when searching for literal strings. The analyzer produces flame graph visualizations showing the execution paths leading to these inefficient operations, helping developers identify and fix performance issues by enabling the plain flag for literal string searches.

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 lj-str-find-no-plain-fgraph -p PID

# trace a shell command directly
orxray analyzer run lj-str-find-no-plain-fgraph -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run lj-str-find-no-plain-fgraph -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run lj-str-find-no-plain-fgraph --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Flame Graphs

Author

The OpenResty Inc. Team.

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