Master Linux Performance in 60 Seconds: 10 Essential Commands
When a Linux server shows performance issues, the first minute is critical; this guide walks you through ten standard command‑line tools—uptime, dmesg, vmstat, mpstat, pidstat, iostat, free, sar, and top—explaining what each metric means and how to interpret the output for quick troubleshooting.
When you notice performance problems on a Linux server, the first 60 seconds are crucial. Netflix’s performance engineering team recommends using a set of standard Linux command‑line tools to quickly assess system health.
The following ten commands provide a snapshot of overall system operation and per‑process resource usage.
1. uptime
$ uptimeThis command shows the system’s average load over the past 1, 5, and 15 minutes, indicating how many tasks are waiting to run. A sudden jump in the 1‑minute load compared to the 15‑minute load often signals a recent issue.
2. dmesg | tail
$ dmesg | tailDisplays the most recent kernel messages, helping you spot errors such as OOM kills or TCP problems that may affect performance.
3. vmstat 1
$ vmstat 1Shows virtual memory and CPU statistics refreshed every second. Key fields include:
r : runnable tasks (higher than CPU count indicates saturation).
free : free memory in KB.
si/so : pages swapped in/out (non‑zero means memory pressure).
us, sy, id, wa, st : CPU time spent in user, system, idle, I/O wait, and steal (virtualization) states.
High wa suggests I/O bottlenecks; high sy (>20%) may indicate inefficient kernel handling.
4. mpstat -P ALL 1
$ mpstat -P ALL 1Displays per‑CPU utilization, useful for spotting uneven load that could point to single‑threaded workloads.
5. pidstat 1
$ pidstat 1Shows per‑process CPU usage at one‑second intervals. The %CPU column is relative to all CPUs, so values above 100% indicate multi‑CPU consumption.
6. iostat -xz 1
$ iostat -xz 1Provides block‑device statistics. Important metrics:
r/s, w/s, rkB/s, wkB/s : read/write request rates and data throughput.
await : average I/O request latency (high values signal saturation).
avgqu‑sz : average queue length (values >1 indicate a bottleneck).
%util : device utilization percentage; >60% often correlates with performance problems.
7. free -m
$ free -mShows memory usage. Pay attention to the buffers and cached columns; the -/+ buffers/cache line gives a more accurate view of memory actually used by applications.
8. sar -n DEV 1
$ sar -n DEV 1Monitors network interface throughput ( rxkB/s, txkB/s) and utilization ( %ifutil), helping you determine if network bandwidth is a limiting factor.
9. sar -n TCP,ETCP 1
$ sar -n TCP,ETCP 1Summarizes TCP activity, including new connections ( active/s), accepted connections ( passive/s), and retransmissions ( retrans/s), which can indicate network or server load issues.
10. top
$ topCombines many of the above metrics in a dynamic view, showing per‑process CPU and memory usage as well as overall system load. While useful, it refreshes quickly, so for intermittent problems tools like vmstat or pidstat that provide rolling output may be more reliable.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
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.
