Linux Performance Monitoring Tools: vmstat, iostat, sar, and perf
When a server is slow, the question is slow because of what. These tools, used together, pinpoint the resource that is the bottleneck. When a server is slow, the question is always: slow because of what. CPU, memory, disk, or network. Linux gives you a precise set of tools to answer that question, and after years of performance troubleshooting, I have a small set I reach for first. Each tool focuses on one resource, and together they form a complete picture. Here is how I use them. vmstat: CPU and Memory at a Glance vmstat reports process, memory, paging, block I/O, and CPU activity in a compact table. I run it with an interval to watch trends. The first line is averages since boot, so I ignore it and look at subsequent lines. vmstat 1 # one line per second vmstat 1 5 # five lines, then stop The columns I watch are the CPU breakdown under the cpu heading: us is user time, sy is system time, id is idle, and wa is wait for I/O. High wa means the CPU is waiting on disk, which points to a storage bottleneck, not…