- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.4k
 
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).
- 
perfutility can be found in thelinux-toolspackage (sudo apt install linux-tools-commonon Ubuntu oryum install perfon CentOS) - Run 
perf record -g -o <file_name> -p <PID> -- sleep <time>, wherefile_nameis 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. - 
perfcan open many file connections (which can sometimes exceed the system limit) resulting in atoo many open fileserror. 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_nameis 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!