Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of IO Real-time Monitoring Command iostat

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "introduction of IO real-time monitoring command iostat". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Iostat is used to output statistics related to CPU and disk Imaco.

Command format

Iostat [- c] [- d] [- h] [- N] [- k |-m] [- t] [- V] [- x] [- z] [device [...] | ALL] [- p [device [,...] | ALL]] [interval [count]]

Description of each parameter of iostat

-c displays only CPU statistics. Mutually exclusive with the-d option. -d displays only disk statistics. Mutually exclusive with the-c option. -k displays the number of disk requests per second in K units, the default unit block. The-p device | ALL and-x options are mutually exclusive and are used to display statistical information about block devices and system partitions. You can also specify a device name after-p, such as # iostat-p hda or display all devices # iostat-p ALL-t prints the time to collect data when outputting data. -V prints version number and help information. -x outputs extension information.

Simple use of iostat

[sdk_test@ssdk1 server] $iostatLinux 2.6.32-431.11.15.el6.ucloud.x86_64 (ssdk1) 10 99.29Device 14 avg-cpu:% user% nice% system% iowait% steal% idle 0.44 0.00 0.26 0.01 99.29Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnvda 0.66 0.09 6.75 1404732 105885456vdb 1.42 12.47 55.86 195619082 876552296

Explain the meaning of each output item:

Avg-%%%%iowait: CPU waits for hardware I% avg-%%%%iowait /

Entry-level use

Iostat-d-k 2 10

The parameter-d indicates that the usage status of the display device (disk) is displayed;-k some columns that use block units force the use of Kilobytes units; 2 means that the data display is refreshed every 2 seconds. 10 means a total of 10 refreshes.

[sdk_test@ssdk1 server] $iostat-d-k 2Linux 2.6.32-431.11.15.el6.ucloud.x86_64 (ssdk1) 10 CPU 142016 _ x86 CPU 644 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 0.66 0.04 3.37 702366 52944164vdb 1.42 6.23 27.93 97809545 438300324Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 2.00 0.00 8.00 0 16vdb 2.00 0.00 24.00 0 48Device: Tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 0.00 0.00 0.00 0 0vdb 0.00 0.00 0.00 0 0Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 0.50 0.00 2.00 0 4vdb 0.00 0.00 0.00 0 0Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 0.00 0.00 0.00 0 0vdb 2.50 0.00 92.00 0 184

Meaning of the output item:

Tps: the number of transmissions per second for the device (Indicate the number of transfers per second that were issued to the device.). "one transfer" means "one Icano request". More than one logical request may be merged into an Ihop O request. The size of the one transfer request is unknown. KB_read/s: the amount of data read from the device (drive expressed) per second; kB_wrtn/s: the amount of data written to the device (drive expressed) per second; kB_read: the total amount of data read; kB_wrtn: the total amount of data written; these units are all Kilobytes.

Specify that the device name for monitoring is vda, and the output of this command is exactly the same as the above command.

All hard disk devices are monitored by default, and only vda is now specified.

Iostat-d vda 2

Extended use of the-X parameter

Iostat also has a more common option-x, which will be used to display extended data related to io.

[sdk_test@ssdk1 server] $iostat-d-x-K1 10Linux 2.6.32-431.11.15.el6.ucloud.x86_64 (ssdk1) 10 _ x86 / 64 _ (4 CPU) Device: rrqm/s wrqm/s r _ Unix s rkB/s wkB/s avgrq-sz avgqu-sz await svctm% 0.00 0.19 0 . 00 0.65 0.04 3.37 10.41 0.00 0.78 0.41 0.03vdb 0.00 5.85 0.29 1.13 6.23 27.93 48.06 0.00 1.44 0.41 0.06Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s Avgrq-sz avgqu-sz await svctm% utilvda 0.00 0.00 0.00 0.00vdb 0.00 0.00 0.00 .00Device: rrqm/s wrqm/s rash s rkB/s wkB/s avgrq-sz avgqu-sz await svctm s rkB/s wkB/s avgrq-sz avgqu-sz await svctm% utilvda 0.00 0.00 0.00 0.00vdb 0.00 0.00 0.00 . 00 0.00 0.00 0.00

Meaning of the output item:

Rrqm/s: how many read requests related to this device have been Merge per second (when the system call needs to read data, VFS sends the request to each FS. If FS finds that different read requests read data from the same Block, FS will merge this request with Merge); wrqm/s: how many write requests related to this device have been Merge per second. Rsec/s: number of sectors read per second; wsec/s: number of sectors written per second. RKB/s:The number of read requests that were issued to the device per second;wKB/s:The number of write requests that were issued to the device per second;avgrq-sz average size of the request sector avgqu-sz is the average length of the request queue. There is no doubt that the shorter the queue, the better. Await: the average processing time (in microseconds and milliseconds) of each IO request. It can be understood as the response time of IO. Generally speaking, the response time of system IO should be lower than that of 5ms, and it is larger if it is greater than 10ms. This time includes queue time and service time, that is to say, in general, await is greater than svctm, and the smaller the difference between them, the shorter the queue time, and the greater the reverse difference, the longer the queue time, indicating that there is something wrong with the system. Svctm represents the average service time (in milliseconds) for each device Istroke O operation. If the value of svctm is very close to that of await, it means that there is almost no Imax O waiting, and the disk performance is good. If the value of await is much higher than the value of svctm, it means that the queue wait of Imax O is too long, and the applications running on the system will be slower. % util: all processing IO times during the statistical time divided by the total statistical time. For example, if the statistical interval is 1 second, the device has 0.8 seconds of processing IO and 0.2 seconds of idle, then the% util of the device = 0.8 shock 1 = 80%, so this parameter indicates how busy the device is. Generally speaking, if this parameter is 100%, it means that the device is running at nearly full capacity (of course, if it is multiple disks, even if the% util is 100%, because of the concurrency of disks, disk usage may not be a bottleneck).

Common usage

Iostat-d-k 1 10 # View TPS and throughput information (disk read and write speed in KB) iostat-d-m 2 # view TPS and throughput information (disk read and write speed in MB) iostat-d-x-k 1 10 # View device utilization (% util), response time (await) iostat-c 1 10 # View cpu status

Case analysis

Ostat-d-k 1 | grep sda10Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnsda10 60.72 18.95 71.53 395637647 1493241908sda10 299.02 4266.67 129.41 4352 132sda10 483.84 4589.90 4544 4076sda10 218.00 3360.00 100.00 3360 100sda10 546.00 8784.00 124.00 8784 124sda10 827.00 13232.00 136.00 13232 136

As you can see above, the average number of disk transfers per second is about 400; disk reads are about 5MB and writes are about 1MB.

Iostat-d-x-k 1Device: rrqm/s wrqm/s r 10.29sda s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm% utilsda 1.56 28.31 7.84 31.50 43.65 3.16 21.82 1.58 1.19 0.80 2.61 10.29sda 1.98 24.75 419.80 6. 93 13465.35 253.47 6732.67 126.73 32.15 2.00 4.70 2.00 85.25sda 3.06 41.84 444.90 54.08 14204.08 2048.98 7102.04 1024.49 32.57 2.10 4.21 1.85 92.24

You can see that the average response time of the disk is 80. The disk response is normal, but it is already busy.

This is the end of the introduction of the IO real-time monitoring command iostat. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report