Interview Prep/Linux/Performance & the USE Method

How do you tell whether an app is CPU-bound, I/O-bound or waiting on something else?

IntermediateProductionPerformance & the USE Method
Answer

Look at the process's state over time:

pidstat -u -d -w -p <pid> 1    # CPU, I/O, context switches
top -H -p <pid>                # threads in R (CPU) vs S/D

Mostly R with high %CPU = CPU-bound. Mostly D with I/O wait = disk-bound. Mostly S with low CPU = waiting on network, locks or downstream services; then look at strace -c, application metrics, or offcputime-bpfcc to see where it sleeps.

All Linux questions Roadmap: Linux

More on Performance & the USE Method