Performance
Performance Mantras Methodology
Found these in Systems Performance by Brendan Gregg. I’m writing them out for easier reference and as a way to further burn them into my mind. Order is from most impactful to least.
- Don’t do it. (Eliminate unnecessary work)
- Do it, but don’t do it again. (Cache it)
- Do it less. (Tune refreshes, polling, etc)
- Do it later. (eg Put a task on the job queue)
- Do it when they’re not looking. (Schedule work to run overnight)
- Do it concurrently. (Use threads)
- Do it more cheaply. (Scale your server up)
First 60 seconds: What to look at first when diagnosing a performance issue on a linux vm**
# load averages
uptime
# kernel messages can be helpful sometimes
dmesg | tail
# rolling process, memory stats
vmstat 1
# rolling cpu states on multicore systems
mpstat -P ALL 1
# rolling ps aux (only shows non-idle processes)
pidstat 1
# rolling disk performance metrics
iostat -xz 1
# available memory, used, swap
free -m
# network visibility
sar -n DEV 1
sar -n TCP,ETCP 1
# running processes in a system
top
And other helpful commands
pidstat 2 [n]
: Samples process resource utilization like top at 2s intervals (n times if specified)