Environment
- YugabyteDB All Versions
Issue
During the course of an investigation, advanced debugging of processes may be required and leverage the Linux perf utility. The Linux perf utility is most commonly executed when investigating high CPU on a given node(s).
Resolution
Overview
The following steps discuss execution of the perf command for advanced debugging scenarios.
Steps
1. Validate if the perf
command is installed by running the following:
which perf
If the command returns blank, the user may need to install perf
by using the respective package managers. In this case, choose one of the following:
-
For Alma/RHEL/Rocky: "To install the package, use the
sudo dnf install perf
command as root or with sudo." -
For Ubuntu/Debian: "To install the package, use the
sudo apt-get install perf
command as root or with sudo."
2. As user root, or via sudo
execute the perf command with the following:
perf record -a -F 99 -g -p $(pgrep -x PROCESS) -- sleep 60
-
-a
: Profile all events (hardware and software). -
-F 99
: Sample every 10 milliseconds (approximately). -
-g
: Enable call graph recording. -
-p $(pgrep -x PROCESS)
: Where PROCESS is the name of the process. Most commonlyyb-tserver
-
-- sleep 60
: Will record for 60 seconds.
The output will look similar to the following:
Warning:
PID/TID switch overriding SYSTEM
[ perf record: Woken up 1641492 times to write data ]
[ perf record: Captured and wrote 0.627 MB perf.data (3060 samples) ]
3. The resulting fille will be called perf.data
. Compress the file and upload the resulting file to a corresponding Zendesk Ticket by running the following command:
gzip perf.data
Comments
0 comments
Please sign in to leave a comment.