Linux Performance Analysis in 60 Seconds
Within the first minute of logging into a Linux server, this guide walks you through ten essential command‑line tools—such as uptime, vmstat, mpstat, pidstat, iostat, free, sar, and top—to quickly assess system load, CPU, memory, disk, and network saturation for effective performance troubleshooting.
When you first log into a Linux server to investigate a performance issue, the first minute should be spent running a set of standard tools that give a quick overview of system health.
Overview
Running the ten commands listed below provides a rough picture of processes and resource usage within sixty seconds. The output highlights errors and resource saturation, helping you decide where to focus further investigation.
uptime
dmesg | tail
vmstat 1
mpstat -P ALL 1
pidstat 1
iostat -xz 1
free -m
sar -n DEV 1
sar -n TCP,ETCP 1
topSome commands require the sysstat package. They support the USE method (Utilization, Saturation, Errors) for pinpointing bottlenecks.
1. uptime
$ uptime
23:51:26 up 21:31, 1 user, load average: 30.02, 26.43, 19.02Shows the system’s average load for the past 1, 5, and 15 minutes, indicating how many processes are runnable or waiting for I/O.
2. dmesg | tail
$ dmesg | tail
[1880957.563150] perl invoked oom‑killer: …
[1880957.563400] Out of memory: Kill process 18694 (perl) …
[2320864.954447] TCP: Possible SYN flooding on port 7001. Dropping request.Displays the most recent kernel messages, useful for spotting OOM kills or network drops.
3. vmstat 1
$ vmstat 1
procs ---------memory---------- ---swap-- -----io---- -system-- ------cpu-----
34 0 0 200889792 73708 591828 0 0 0 5 6 10 96 1 3 0 0
…Shows per‑second snapshots of processes, memory, swap, I/O, and CPU breakdown. Important columns include r (runnable processes), free (idle memory), si/so (swap activity), and us, sy, id, wa, st (CPU time distribution).
4. mpstat -P ALL 1
$ mpstat -P ALL 1
CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
all 98.47 0.00 0.75 0.00 0.00 0.00 0.00 0.00 0.00 0.78
0 96.04 0.00 2.97 …Prints per‑CPU utilization, helping to detect unbalanced load or single‑threaded bottlenecks.
5. pidstat 1
$ pidstat 1
UID PID %usr %system %guest %CPU CPU Command
0 9 0.00 0.94 0.00 0.94 1 rcuos/0
0 4214 5.66 5.66 0.00 11.32 15 mesos‑slave
…Provides a rolling view of CPU usage per process, similar to top but without screen‑refresh.
6. iostat -xz 1
$ iostat -xz 1
avg‑cpu: %user %nice %system %iowait %steal %idle
73.96 0.00 3.73 0.03 0.06 22.21
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq‑sz avgqu‑sz await r_await w_await svctm %util
xvda 0.00 0.23 0.21 0.18 4.52 2.08 …Shows block‑device statistics; key fields are r/s, w/s, rkB/s, wkB/s (throughput), await (average I/O latency), avgqu‑sz (queue length), and %util (device utilization).
7. free -m
$ free -m
total used free shared buffers cached
Mem: 245998 24545 221453 83 59 541
‑/+ buffers/cache: 23944 222053Reports memory usage, distinguishing between used memory, buffers, and page cache.
8. sar -n DEV 1
$ sar -n DEV 1
IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
eth0 18763.00 5032.00 20686.42 478.30 0.00 0.00 0.00 0.00
…Monitors network interface throughput and utilization.
9. sar -n TCP,ETCP 1
$ sar -n TCP,ETCP 1
active/s passive/s iseg/s oseg/s
1.00 0.00 10233.00 18846.00
…Shows TCP statistics such as active/passive connections and retransmissions, useful for detecting network‑related problems.
10. top
$ top
Tasks: 871 total, 1 running, 868 sleeping …
%Cpu(s): 96.8 us, 0.4 sy, 2.7 id, 0.1 wa …
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20248 root 20 0 0.227t 0.012t 18748 S 3090 5.2 …Provides a real‑time snapshot of the most active processes and overall system metrics, complementing the earlier per‑second tools.
Together these commands give a rapid, reproducible “first‑60‑seconds” checklist for Linux performance troubleshooting, allowing you to identify saturation, errors, and resource‑heavy processes before diving deeper with more detailed profiling.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.