The output of the linuxiostat command briefly indicates that iostat is a built-in tool for Linux systems. it is used to view the CPU time slice distribution statistics or hard disk IO statistics of machines. Due to the existence of powerful top commands (output more detailed CPU/Memory statistics), iost... the output of the linux iostat command briefly indicates that iostat is a built-in tool for Linux systems. it is used to view the CPU time slice distribution statistics or hard disk IO statistics of machines. Due to the existence of powerful top commands (output more detailed CPU/Memory statistics), iostat is used to view the IO status of hard disk devices in most cases, it is particularly useful in analyzing machine I/O pressure or bottlenecks. This document describes the typical usage of iostat and the meaning of output data. 1. the default output of iostat is as follows: [plain] Linux 2.6.9xenu _ 7-0-0-0 (demo-hostname) 06/21/2013 avg-cpu: % user % nice % sys % iowait % idle 1.65 0.00 0.62 0.60 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda1 1.29 1.09 12.38 11546642 130611280 sda2 0.00 0.00 0.00 296 0 sda3 11.79 142.71 395.95 1505879770 4178084600 according to man, if iostat is executed for the first time on this machine, the statistical output time range is from the start time of the machine to the time when the iostat command is executed. Otherwise, the collection time range is the time range from the last iostat execution time to the current execution time. From the output content, we can see that iostat first outputs 1st behaviors: linux kernel version, hostname, and command run time. the following lines of content are divided into two parts: cpu statistics; Device statistics, the descriptions are as follows. 1) the cpu statistics are output on the machine of kernel 2.6.9. the avg-cpu output consists of five fields, of which % user/% nice/% sys/% idle is easier to understand, I will not go into details here. % Iowait indicates the CPU idle time caused by the machine responding to disk IO requests, the value of this field is usually greater than the statistical value of this field on CPU-intensive machines. In machines whose kernel version is 2.6.32, the % steal field may also exist, which means: show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor. 2) Device statistics output the Device here is usually hard disk, that is, hard disk. The output includes six fields, which are described below. Device: The list of devices on the machine, usually the block Device name (in linux, the block Device corresponds to a character Device. for the differences between the two, refer to here for details) or partition name, such as sda1/sda2/sda3 in the preceding example; tps: the number of transfers per second (transfers) for the device. here, "transfer" refers to the I/O request. It should be noted that multiple logical requests may be merged into one I/O request by the operating system, the scheduling algorithm for disk access in linux uses this policy (if you are interested, you can search for the keyword "merging" in this article to understand the optimization of requests merging by linux io schedging); Blk_read/s: the data size read from the device per second. here, the data volume is measured in blocks. In kernel 2.4 and later versions, the block refers to the sector (sector). Therefore, 1 block = 512 bytes; in versions earlier than kernel 2.4, the block size is unknown; Blk_wrtn/s: the size of data written to the device per second. the data size is also described in blocks. Blk_read: total data read from the device since the system is powered on (unit: block); Blk_wrtn: since the system is powered on, total number of data written to the device (unit: block ). 2. when iostat-d-k or iostat-c iostat is not added with any parameters, avg-cpu and device statistics are output by default. If we only care about the device statistics, we can use-d to explicitly specify that only the statistics related to the device are output. In addition, the default unit of device statistics is block (= 512 Kbytes). we can use-k to specify the output statistical value in kilobytes. For example, input iostat-d-k on the shell Terminal. the output format is as follows: [plain] Linux 2.6.9xenu _ 7-0-0-0 (demo-hostname) 06/29/2013 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda1 1.29 0.51 6.16 5789577 69260268 sda2 0.00 0.00 0.00 148 0 sda3 11.23 67.20 187.49 755494461 2107939224 can be seen, compared with the default output format, the output contains four field names and values all changed: the field name changes from Blk_xxx to kB_xxx (indicating that the unit of these fields is changed from block to kB), and the value is approximately 512 times the original value. If we only care about avg-cpu statistics, we can explicitly specify them through iostat-c. 3. iostat other usage 1) iostat interval count iostat outputs statistical results only once after one call by default. in actual use, it is usually called only once, then, it automatically outputs n consecutive requests at a fixed interval. You can use the optional interval and count parameters to achieve this purpose (for details about the two parameters, refer to man ). For example, iostat 1 100 indicates that the output is made once every 1 s and 100 times in total. 2) iostat-p device | ALL when the linux host is composed of multiple disks, when we only care about the statistical data of one or more devices, we can explicitly specify to output only the statistical data of the specified device through iostat-p sda1 [sda2] [sdan. Iostat-p ALL indicates that statistics on ALL block devices or partitions defined in the system need to be output, including those devices that have never been used. In this case, the output content may contain device names such as ram0, which indicates ramdisk. for details, refer https://wiki.archlinux.org/index.php/Ramdisk . Note: The ALL parameter is valid only in kernel 2.5 and later versions. In addition to the usage listed above, various parameters can also be used in combination, which is not expanded here due to space limitations. If you want to know about it, try it on your own machine and the learning effect will be better.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service