仮想メモリ統計コマンド vmstat(8)(Virtual Memory STATistics)を試してみます。
1. 環境
さくらのクラウド(IaaS) 2CPU 2GB
$ cat /etc/redhat-release
CentOS Stream release 8
2. シンプルに動作させてみる
$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1455792 65984 333008 0 0 0 2 44 54 0 0 100 0 0
分類 | 項目 | 説明 |
---|---|---|
procs | r | ランキューの長さ、実行可能スレッドの総数 |
procs | b | 割り込み不可能なスリープ状態にあるプロセス数 |
memory | swpd | スワップアウトされたメモリの容量 |
memory | free | 空きメモリ容量 |
memory | buff | バッファキャッシュ内のメモリ容量 |
memory | cache | ページキャッシュ内のメモリ容量 |
swap | si | スワップイン(ページング)されたメモリの容量 |
swap | so | スワップアウト(ページング)されたメモリの容量 |
cpu | us | ユーザー時間 |
cpu | sy | システム時間 |
cpu | id | アイドル時間 |
cpu | wa | I/O待ちの時間。スレッドがディスクI/Oのためにブロックされていて、CPUがアイドル状態になっている時間 |
cpu | st | 盗まれた(STolen)時間。仮想環境でほかのテナントにサービスを提供するために使われたCPU時間 |
3. 連続動作させてみる
3秒毎に4回
$ vmstat 3 4
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 1455444 66140 333152 0 0 0 2 44 54 0 0 100 0 0
0 0 0 1455396 66140 333152 0 0 0 0 116 137 0 0 100 0 0
0 0 0 1455236 66140 333152 0 0 0 0 103 119 0 0 100 0 0
0 0 0 1455268 66140 333152 0 0 0 0 86 107 0 0 100 0 0
4. ヘルプ情報
$ vmstat -h
Usage:
vmstat [options] [delay [count]]
Options:
-a, --active active/inactive memory
-f, --forks number of forks since boot
-m, --slabs slabinfo
-n, --one-header do not redisplay header
-s, --stats event counter statistics
-d, --disk disk statistics
-D, --disk-sum summarize disk statistics
-p, --partition <dev> partition specific statistics
-S, --unit <char> define display unit
-w, --wide wide output
-t, --timestamp show timestamp
-h, --help display this help and exit
-V, --version output version information and exit
For more details see vmstat(8).