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.
More on Performance & the USE Method
What is the USE method?BeginnerMap the USE method to concrete Linux commands.IntermediateWhat is your "first 60 seconds" checklist on a slow server?IntermediateHow do you read vmstat output?IntermediateHow do you read `iostat -xz 1`?IntermediateWhat is sar and why install sysstat on every server?Beginner