Interview Prep/Linux/Performance & the USE Method

How do you profile why an application is slow but not using CPU?

AdvancedProductionPerformance & the USE Method
Answer

It is blocked off-CPU: on locks, disk, network or sleeps. Use off-CPU analysis:

sudo offcputime-bpfcc -p <pid> -f 30 > offcpu.stacks   # folded stacks for flame graph
sudo strace -f -T -p <pid> -e trace=network,read,write   # time per syscall
sudo tcplife-bpfcc                                       # connection durations

Then correlate with downstream latency (database slow log, upstream timings, connection pool waits).

All Linux questions Roadmap: Linux

More on Performance & the USE Method