Linuxシステムにてディスクボトルネックを確認する為のコマンド

VMSTAT

[root@HOME001 ~]# 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 1663492  10488 167444    0    0    62    19   31   58  1  0 97  2  0
[root@HOME001 ~]#

IOSTAT

[root@HOME001 ~]# iostat
Linux 2.6.32-279.el6.i686 (HOME001.localdomain)         2012年12月29日  _i686_  (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.66    0.00    0.54    1.83    0.00   96.98

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.70       142.88        44.06     284638      87784
dm-0              7.92       129.00        44.04     256994      87728
dm-1              0.16         1.29         0.00       2576          0
dm-2              0.06         0.46         0.01        922         24

[root@HOME001 ~]# 

[root@HOME001 iotop-0.4.4]# iostat -d -x
Linux 2.6.32-279.el6.i686 (HOME001.localdomain)         2012年12月29日  _i686_  (1 CPU)

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.67     3.11    1.39    0.39    88.43    27.72    65.42     0.21  115.80  11.72   2.08
dm-0              0.00     0.00    1.57    3.42    80.07    27.33    21.51     1.78  356.10   3.90   1.95
dm-1              0.00     0.00    0.10    0.00     0.77     0.00     8.00     0.00    5.24   2.16   0.02
dm-2              0.00     0.00    0.05    0.05     0.37     0.38     7.93     0.00   16.82  12.62   0.12

[root@HOME001 iotop-0.4.4]#

[root@HOME001 iotop-0.4.4]# iostat -d -x dm-0 15 10
Linux 2.6.32-279.el6.i686 (HOME001.localdomain)         2012年12月29日  _i686_  (1 CPU)

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
dm-0              0.00     0.00    1.53    3.32    77.73    26.54    21.51     1.73  356.00   3.92   1.90

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
dm-0              0.00     0.00    0.00    0.20     0.00     1.60     8.00     0.02  112.33 112.33   2.25

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

iostat

iostat-part

Iotop
http://guichaz.free.fr/iotop/

Linux has always been able to show how much I/O was going on (the bi and bo columns of the vmstat 1 command).
Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on.
It requires Python ≥ 2.5 (or Python ≥ 2.4 with the ctypes module) and a Linux kernel ≥ 2.6.20 with the
TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.

必要なカーネルとPythonのバージョン確認

[root@HOME001 tools]# uname -r
2.6.32-279.el6.i686
[root@HOME001 tools]# python -V
Python 2.6.6
[root@HOME001 tools]#

uname_python

ダウンロードとインストール

[root@HOME001 tools]# wget http://guichaz.free.fr/iotop/files/iotop-0.4.4.tar.gz
--2012-12-29 07:12:15--  http://guichaz.free.fr/iotop/files/iotop-0.4.4.tar.gz
guichaz.free.fr をDNSに問いあわせています... 212.27.63.130
guichaz.free.fr|212.27.63.130|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 30334 (30K) [application/x-gzip]
`iotop-0.4.4.tar.gz' に保存中

100%[=============================================================================>] 30,334      21.8K/s 時間 1.4s

2012-12-29 07:12:17 (21.8 KB/s) - `iotop-0.4.4.tar.gz' へ保存完了 [30334/30334]

[root@HOME001 tools]# tar zxvf iotop-0.4.4.tar.gz
iotop-0.4.4/
iotop-0.4.4/COPYING
iotop-0.4.4/PKG-INFO
iotop-0.4.4/NEWS
iotop-0.4.4/iotop/
iotop-0.4.4/iotop/__init__.py
iotop-0.4.4/iotop/netlink.py
iotop-0.4.4/iotop/ioprio.py
iotop-0.4.4/iotop/version.py
iotop-0.4.4/iotop/data.py
iotop-0.4.4/iotop/ui.py
iotop-0.4.4/iotop/genetlink.py
iotop-0.4.4/iotop/vmstat.py
iotop-0.4.4/.gitignore
iotop-0.4.4/iotop.py
iotop-0.4.4/ChangeLog
iotop-0.4.4/setup.py
iotop-0.4.4/README
iotop-0.4.4/iotop.1
iotop-0.4.4/setup.cfg
iotop-0.4.4/THANKS
iotop-0.4.4/bin/
iotop-0.4.4/bin/iotop
[root@HOME001 tools]#

[root@HOME001 iotop-0.4.4]# ./setup.py install
running install
running build
running build_py

install

iotopの実行

[root@HOME001 iotop-0.4.4]# /usr/bin/iotop
Total DISK READ:       0.00 B/s | Total DISK WRITE:       0.00 B/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
    3 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    4 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
    5 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    6 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/0]
    7 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [events/0]
    8 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [cgroup]
    9 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [khelper]
   10 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [netns]
[root@HOME001 iotop-0.4.4]#


[root@HOME001 iotop-0.4.4]# iotop -bto --iter=1
07:27:50 Total DISK READ:       0.00 B/s | Total DISK WRITE:       0.00 B/s
    TIME  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN      IO    COMMAND
[root@HOME001 iotop-0.4.4]#

iotop

iotop_optopm

以下パッケージでも入手可能との事
sudo aptitude install iotop
sudo yum install iotop
sudo emerge iotop
sudo pacman -Sy iotop

参考
http://guichaz.free.fr/iotop/

Using iotop to check I/O and swap

htopでパフォーマンス確認

Comments are closed.

Post Navigation