How do you capture system state during an intermittent performance issue?
IntermediateProductionPerformance & the USE Method
Answer
Record continuously so the evidence exists when it happens: atop or sysstat at 1-minute (or finer) intervals, perf/eBPF triggered by a threshold, and application metrics. A simple trigger script:
while sleep 5; do
if [ "$(cut -d' ' -f1 /proc/loadavg | cut -d. -f1)" -gt 20 ]; then
{ date; top -b -n1 -H | head -50; ps -eo stat,pid,cmd | awk '$1~/D/'; } >> /var/tmp/spike.log
fi
done
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