iostat
I/Oを測定する為のお馴染みのコマンドですが、使い方をなかなか覚えられないのでメモ。大きく、CPU、デバイスI/Oのおのおのの使用率を計測するすることができます。
CPUの使用率の計測
「-c」でCPUの使用率をレポート。
The report consists of a CPU header row followed by a row of CPU statistics. On multipro-cessor systems, CPU statistics are calculated system-wide as averages among all processors.(man iostat)
マルチプロセッサ環境では各プロセッサの平均値を計算して統計情報を算出します。
masayuki@web:~$ iostat -c Linux 2.6.18-92.1.13.el5.028stab059.6 (web.nynoc.com) 12/20/09 _i686_ avg-cpu: %user %nice %system %iowait %steal %idle 0.07 0.00 0.01 0.09 0.00 99.83
各値はパーセンテージで、全部足すと100%になります。%userと%niceはユーザモードのCPU使用率、%systemはカーネルモードのCPU使用率を表します。%iowaitはdiskI/O待ち、idleはアイドル状態の割合。%stealは、別の仮想CPUが動いている間に待たされている時間?
%steal
Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.(man iowait)
デバイスI/Oの計測
「-d」でデバイスI/Oのレポートする。「-dx」でより詳細にレポート。
masayuki@web:~$ iostat -dx Linux 2.6.18-92.1.13.el5.028stab059.6 (web.nynoc.com) 12/20/09 _i686_ Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
仮想サーバ環境(多分OpenVZ)では、なぜか正常に表示されませんでした。VMWare Playerだと、
root@ubuntu-vm:~# iostat -dx Linux 2.6.24-18-generic (ubuntu-vm) 2009年12月20日 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 1.87 8.36 6.61 0.81 200.08 73.32 36.87 0.13 18.20 5.07 3.76
r/sとw/sは1秒あたりの読み書きの回数、rkB/sとwkB/sは1秒あたりの読み書きの量をKB単位で表しています。%util欄はマシンのCPU時間に対して各デバイスに費やした時間の割合。avguq-szの値は新しいジョブが待ち行列に追加された時、キューイングされたI/Oジョブの平均の数とのこと。
- 作者: Cal Henderson,武舎広幸,福地太郎,武舎るみ
- 出版社/メーカー: オライリー・ジャパン
- 発売日: 2006/12/26
- メディア: 大型本
- 購入: 4人 クリック: 115回
- この商品を含むブログ (70件) を見る