Interview Prep/Linux/Performance & the USE Method

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
All Linux questions Roadmap: Linux

More on Performance & the USE Method