-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Debug Performance Issues Using Perf
Lukas Joswiak edited this page May 6, 2021
·
2 revisions
perf
: https://perf.wiki.kernel.org/index.php/Main_Page is a linux profiler which will allow you to monitor the CPU utilization of a single process. Perf is a useful tool to check whether CPU time is being spent in the appropriate places and to identify potential performance bugs (by seeing which functions are consuming the most CPU cycles).
-
perf
utility can be found in thelinux-tools
package (sudo apt install linux-tools-common
on Ubuntu oryum install perf
on CentOS) - Run
perf record -g -o <file_name> -p <PID> -- sleep <time>
, wherefile_name
is the file which stores the results of the analysis, PID is the process being monitored (which in our case is the PID offdbserver
) and<time>
is the amount of time (in seconds) which the profiling occurs over. -
perf
can open many file connections (which can sometimes exceed the system limit) resulting in atoo many open files
error. To increase the ulimit follow the instructions here: https://www.tecmint.com/increase-set-open-file-limits-in-linux/ - To visualize the perf results, run the following command:
perf report -i <file_name> --no-children
, wherefile_name
is the same value used in step 2. This will show you which functions used the most CPU time. There are other visualization possibilities as well so go over the wiki for a full rundown of the options available.
See https://forums.foundationdb.org/t/profiling-foundationdb/1337 for a lot more info!