--- title: vmstat โ€” system load summary date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: A tool that periodically summarizes and shows CPU, memory, swap, and I/O status. Useful for identifying bottlenecks. tags: program, Fault diagnosis and recovery, vmstat --- **๐Ÿ’ฌ "vmstat command"** vmstat **summarizes CPU, memory, and I/O in a single line**. It quickly identifies where the bottleneck is. Starting from the second line, the values are actual measurements; specify an interval to observe continuously. - **r / b**: number of processes waiting to run / blocked. - **si / so**: swap in/out. If not 0, it indicates memory pressure. - **bi / bo**: block I/O. This is a disk bottleneck indicator. - **wa**: percentage of CPU waiting on I/O. If high, it indicates a disk bottleneck. ## Frequently used options | Option | Description | | --- | --- | | | e.g., vmstat 1 5 (5 times at 1-second intervals) | | -s | Memory-related statistics summary | | -d | Per-disk statistics | | -w | Wide output format | ## Three essential command combinations - `vmstat 1 5` โ€” system summary at 1-second intervals, 5 times - `vmstat -s | head` โ€” memory statistics summary - `vmstat -d | head -5` โ€” per-disk I/O statistics **๐Ÿ’ฌ "Just point out one pattern commonly used on real production servers"** Here are common situations encountered on real production servers, organized step by step. ### Step 1 ยท Summary observation Measure for a few seconds and observe the trend. ``` vmstat 1 5 ``` ### Step 2 ยท Identify the bottleneck If si/so is high, it is memory; if wa is high, it is disk. ``` vmstat 1 5 | awk '{print $1,$2,$7,$8,$16}' ``` ### Step 3 ยท Find the cause Look at the process using that resource. ``` ps -eo pid,%cpu,rss,comm --sort=-rss | head ``` ## How it is used in practice ### 1. Identifying I/O bottlenecks **Situation** โ€” The server is slow, but the CPU is idle. ``` vmstat 1 5 ``` **Result** โ€” If wa (wait) is high and bi/bo is large, it is a disk bottleneck. **Point** โ€” Use iostat to narrow down which disk, then identify the process. ### 2. Detecting swap usage **Situation** โ€” Check whether memory is insufficient. ``` vmstat 1 5 | awk 'NR>2{print $7,$8}' ``` **Result** โ€” If si/so is not 0, swap is actually being used. **Point** โ€” Heavy swapping causes a sharp drop in performance. ## Things to keep in mind - The first line is an average since boot, so do not use it as a measurement. - A single run without an interval is a snapshot and misses trends. - In containers, host-wide values may be displayed. ## Actual execution output This is the result of observing CPU, memory, and I/O status at 1-second intervals. ![vmstat command execution result: system load summary](https://games.aidebatehub.com/assets/vmstat-demo.png) Production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/troubleshooting/vmstat.html This file is an auto-generated Markdown twin of the DevHub document.