linux系統性能之磁盤讀寫

218G 數據 ,14個進程並行拷貝,16G     ./c-routing-engine
1.9G    ./expr
14G     ./guide
24G     ./offline
3.0G    ./rank
8.9G    ./rws
2.9G    ./ra
22G     ./re00
14G     ./re01
22G     ./re1
9.3G    ./re2
14G     ./re3
26G     ./re4
29G     ./re5
17G     ./rec1ios

SSD :耗時15minsexpress

普通磁盤:29mins bash

 

最近有需求是從網絡磁盤想本地拷貝數據,而後運行程序,完後再將數據從本地拷貝到網磁盤,因爲數據可能有幾十 G 至 200G 左右,因此想觀察一下系統瓶頸在哪?網絡

相關指令:app

首先 、用top命令查看ide

top - 11:53:16 up 1 day, 19:10,  2 users,  load average: 1.20, 2.92, 3.55
Tasks: 930 total,   2 running, 927 sleeping,   1 stopped,   0 zombie
Cpu(s):  2.6%us,  0.2%sy,  0.0%ni, 97.2%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  132044872k total, 125619664k used,  6425208k free,  1252580k buffers
Swap:        0k total,        0k used,        0k free, 41233480k cached

查看12.6% wa ,IO等待所佔用的CPU時間的百分比,若是高過30%時IO壓力高;post

其次、 用iostat -x 1 10ui

若是 iostat 沒有,要  yum install sysstatthis

map@~~~~~/$ iostat
Linux 2.6.32_1-18-0-0 (<>.com)         08/19/2016      _x86_64_        (40 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.14    0.06    0.69    1.30    0.00   95.82

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              59.14      8499.04     17870.40 1321789708 2779243760
sdb               2.22         0.47      1537.57      72498  239126000
sdc               2.45         0.15      1599.44      23082  248747664
sdd               2.49         3.52      1721.23     547042  267689592
sde               0.02         0.13         1.80      20098     279287
sdf               0.02         0.13         1.80      20098     279287

 

iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices, partitions and network filesystems (NFS).spa

CPU Utilization Report

The  first  report  generated  by the iostat command is the CPU Utilization Report. For multiprocessor systems, the CPU values are global averages among all processors.  The report has the following format:

%user   Show the percentage of CPU utilization that occurred while executing at the user level (application).

%nice   Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.

%system    Show the percentage of CPU utilization that occurred while executing at the system level (kernel).

%iowait      Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.

%steal       Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.

%idle         Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
 

 Device Utilization Report

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              59.14      8499.04     17870.40 1321789708 2779243760

tps:Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the  device.  Multiple  logical requests can be combined into a single I/O request to the device. A transfer is of indeterminate size.

Blk_read/s、Blk_wrtn/s :Indicate  the amount of data read from the device expressed in a number of blocks per second. Blocks are equivalent to sectors with kernels 2.4 and later and therefore have a size of 512 bytes. With older kernels, a block is of indeterminate size.

Blk_rea、Blk_wrtn:The total number of blocks read.

rrqm/s:The number of read requests merged per second that were queued to the device.

r/s、w/s:The number of read requests that were issued to the device per second.           

avgrq-sz:The average size (in sectors) of the requests that were issued to the device.

avgqu-sz:The average queue length of the requests that were issued to the device.

await:The average time (in milliseconds毫秒) for I/O requests issued to the device to be served. This includes the time  spent  by  the  requests  in queue and the time spent servicing them.

svctm:The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more. This field will be removed in a future sysstat version.

%util:Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.

Network Filesystem report

 

OPTIONS
       -c     Display the CPU utilization report.

       -d     Display the device utilization report.

       -h     Make the NFS report displayed by option -n easier to read by a human.

       -k     Display statistics in kilobytes per second instead of blocks per second.  Data displayed are valid only with kernels 2.4 and later.

       -m     Display statistics in megabytes per second instead of blocks or kilobytes per second. Data displayed are valid only with kernels 2.4 and later.

       -N     Display the registered device mapper names for any device mapper devices.  Useful for viewing LVM2 statistics.

       -n     Display the network filesystem (NFS) report. This option works only with kernel 2.6.17 and later.

       -p [ { device [,...] | ALL } ]
              The -p option displays statistics for block devices and all their partitions that are used by the system.  If a device name is entered on the command line, then statistics for it and all its partitions are displayed. Last, the ALL keyword indicates that statistics have to be  displayed  for all the block devices and partitions defined by the system, including those that have never been used.  Note that this option works only with post 2.5 kernels.

       -t     Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below).

       -V     Print version number then exit.

       -x     Display extended statistics.  This option works with post 2.5 kernels since it needs /proc/diskstats file or a mounted sysfs to  get  the  statistics.  This  option may also work with older kernels (e.g. 2.4) only if extended statistics are available in /proc/partitions (the kernel needs to be patched for that).

       -z     Tell iostat to omit output for any devices for which there was no activity during the sample period.

iostat
Display a single history since boot report for all CPU and Devices.

iostat -d 2
Display a continuous device report at two second intervals.

iostat -d 2 6
Display six reports at two second intervals for all devices.

iostat -x hda hdb 2 6
Display six reports of extended statistics at two second intervals for devices hda and hdb.

iostat -p sda 2 6
Display six reports at two second intervals for device sda and all its partitions (sda1, etc.)
相關文章
相關標籤/搜索