Performance Monitoring

0%
Performancetophtopvmstatiostatpidstatperfbpftracesar

Performance Monitoring

7 interactive questions

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

What tools do you use for CPU/memory/disk performance?

Click to reveal answer
PerformanceAnswer

CPU: top/htop (interactive), pidstat 1 (per-process), mpstat -P ALL 1 (per-core), perf top (sampling profiler). Memory: free -h, vmstat 1, smem (proportional set size). Disk: iostat -xz 1, iotop, sar -d 1. Network: sar -n DEV 1, iftop, nethogs.

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

What is load average and what do the 3 numbers mean?

Click to reveal answer
PerformanceAnswer

1-min, 5-min, 15-min exponentially weighted average of runnable + uninterruptible (D state) processes. Not just CPU — includes disk wait. If >> CPU cores, system is saturated.

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

What is the difference between `top` and `htop`?

Click to reveal answer
PerformanceAnswer

top — built-in, minimal deps, available everywhere. htop — interactive, scrollable, tree view, colors, mouse support, better UX. Install htop if available; top is always there.

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

How do you find which process is eating CPU?

Click to reveal answer
PerformanceAnswer

pidstat 1 or top (press P to sort by CPU). For deep dive: perf top -p <PID> or perf record -g -p <PID> then perf report.

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

What is `iowait` and how do you troubleshoot it?

Click to reveal answer
PerformanceAnswer

CPU % waiting for block I/O (D state). High wa% in top/vmstat. Check iostat -xz 1 — high await/svctm on a device. Find culprit: iotop -o, pidstat -d 1.

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

How do you profile an application with `perf`?

Click to reveal answer
PerformanceAnswer

perf record -g -- <cmd> records call stacks. perf report shows flame graph. perf stat -- <cmd> gives summary (cycles, cache misses, branches). Use perf flamegraph for visualization.

PerformanceQuestion
tophtopvmstatiostatpidstatperfbpftracesar

What is `bpftrace` and when to use it?

Click to reveal answer
PerformanceAnswer

eBPF-based dynamic tracing — safe, no kernel modules, programmable. One-liners: bpftrace -e 'tracepoint:syscalls:sys_enter_openat { printf("%s %s\n", comm, str(args->filename)); }'. Great for production debugging without restart.