0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Linux vmstatコマンド を試してみる

Last updated at Posted at 2021-10-11

仮想メモリ統計コマンド 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).

5. 参考

絵で見てわかるシステムパフォーマンスンの仕組み:翔泳社
詳解 システム・パフォーマンス:O'Reilly

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?