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

How to test the IO performance of linux hard disk by iostat

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Iostat how to test the IO performance of linux hard disk, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Recently, the company installed several DELL PE2650 and 2850 servers, the unified installation is the RHLE5.132 bit system, and the server's SCSI hard drives are unified to do raid1. The company boss asked the hard disk IO to make a unified test report, found a lot of tools under Linux, found that the most practical is iostat, which requires the first installation of sysstat, that is, yum-y install sysstat; company's internal yum server to build this is not the focus of this article, here will not be described in detail.

# iostat-x 1 10

Linux 2.6.18-92.el5xen 03Universe 2010

Avg-cpu:% user nice% system% iowait% steal% idle

1.10 0.00 4.82 39.54 0.07 54.46

Device: rrqm/s wrqm/s rUnip s wdeband s rsec/s wsec/s avgrq-sz avgqu-sz await svctm% util

Sda 0.00 3.50 0.40 2.50 5.60 48.00 18.48 0.00 0.97 0.97 0.28

Sdb 0.00 0.00 0.00

Sdc 0.00 0.00 0.00

Sdd 0.00 0.00 0.00

Sde 0.00 0.10 0.30 0.20 2.40 2.40 9.60 0.00 1.60 1.60 0.08

Sdf 17.40 0.50 102.00 0.20 12095.20 5.60 118.40 0.70 6.81 2.09 21.36

Sdg 232.40 1.90 379.70 0.50 76451.20 19.20 201.13 4.94 13.78 2.45 93.16

Rrqm/s: the number of merge reads per second. Namely delta (rmerge) / s

Wrqm/s: the number of merge writes per second. Namely delta (wmerge) / s

Rdyne s: the number of times the read of the Iripple O device was completed per second. Namely delta (rio) / s

Wthumb s: the number of writes completed by the I _ swap O device per second. Namely delta (wio) / s

Rsec/s: read sectors per second. Namely delta (rsect) / s

Wsec/s: the number of sectors written per second. Namely delta (wsect) / s

RkB/s: read K bytes per second. Is half the rsect/s because the size of each sector is 512 bytes. (need to calculate)

WkB/s: write K bytes per second. It's half of wsect/s. (need to calculate)

Avgrq-sz: the average data size (sector) per device Istroke O operation. Delta (rsect+wsect) / delta (rio+wio)

Avgqu-sz: average Imax O queue length. That's delta (aveq) / aveq 1000 (because it's in milliseconds).

Await: the average wait time (in milliseconds) for each device Istroke O operation. That is, delta (ruse+wuse) / delta (rio+wio)

Svctm: the average service time (in milliseconds) for each device Istroke O operation. That is, delta (use) / delta (rio+wio)

% util: how many percent of the time in a second is spent on the Imax O operation, or how much time in a second the Ipicuro queue is not empty. That is, delta (use) / use 1000 (because it is in milliseconds)

If% util is close to 100%, it means that too many requests have been generated and the system is fully loaded. The disk

There may be bottlenecks; when the idle is less than 70%, the IO pressure is higher, and generally the read speed has more wait.

At the same time, you can check parameter b (number of processes waiting for resources) and wa parameter (percentage of CPU time spent by IO waiting) in conjunction with vmstat. IO pressure is high when it is higher than 30%.

In addition, you can also refer to

General:

Svctm

< await(因为同时等待的请求的等待时间被重复计算了), svctm的大小一般和磁盘性能有关:CPU/内存的负荷也会对其有影响,请求过多也会间接导致 svctm 的增加。 await:await的大小一般取决于服务时间(svctm) 以及 I/O 队列的长度和 I/O 请求的发出模式。 如果svctm 比较接近await,说明I/O 几乎没有等待时间; 如果await 远大于svctm,说明I/O队列太长,应用得到的响应时间变慢 如果响应时间超过了用户可以容许的范围,这时可以考虑更换更快的磁盘,调整内核elevator算法,优化应用,或者升级 CPU。 队列长度(avgqu-sz)也可作为衡量系统 I/O 负荷的指标,但由于 avgqu-sz 是按照单位时间的平均值,所以不能反映瞬间的 I/O 洪水。 别人一个不错的例子(I/O 系统vs超市排队) 举一个例子,我们在超市排队 checkout 时,怎么决定该去哪个交款台呢? 首当是看排的队人数,5个人总比20人要快吧?除了数人头,我们也常常看看前面人购买的东西多少,如果前面有个采购了一星期食品的大妈,那么可以考虑换个队排了。还有就是收银员的速度了,如果碰上了连钱都点不清楚的新手,那就有的等了。另外,时机也很重要,可能 5分钟前还人满为患的收款台,现在已是人去楼空,这时候交款可是很爽啊,当然,前提是那过去的 5 分钟里所做的事情比排队要有意义(不过我还没发现什么事情比排队还无聊的)。 I/O 系统也和超市排队有很多类似之处: r/s+w/s 类似于交款人的总数 平均队列长度(avgqu-sz)类似于单位时间里平均排队人的个数 平均服务时间(svctm)类似于收银员的收款速度 平均等待时间(await)类似于平均每人的等待时间 平均I/O数据(avgrq-sz)类似于平均每人所买的东西多少 I/O 操作率 (%util)类似于收款台前有人排队的时间比例。 我们可以根据这些数据分析出 I/O 请求的模式,以及 I/O 的速度和响应时间。 下面是别人写的这个参数输出的分析 # iostat -x 1 avg-cpu: %user %nice %sys %idle 16.24 0.00 4.31 79.44 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util /dev/cciss/c0d0 0.00 44.90 1.02 27.55 8.16 579.59 4.08 289.80 20.57 22.35 78.21 5.00 14.29 /dev/cciss/c0d0p1 0.00 44.90 1.02 27.55 8.16 579.59 4.08 289.80 20.57 22.35 78.21 5.00 14.29 /dev/cciss/c0d0p2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 上面的 iostat 输出表明秒有 28.57 次设备 I/O 操作: 总IO(io)/s = r/s(读) +w/s(写) = 1.02+27.55 = 28.57 (次/秒) 其中写操作占了主体 (w:r = 27:1)。 平均每次设备 I/O 操作只需要 5ms 就可以完成,但每个I/O 请求却需要等上 78ms,为什么? 因为发出的 I/O 请求太多 (每秒钟约29 个),假设这些请求是同时发出的,那么平均等待时间可以这样计算: 平均等待时间 = 单个I/O 服务时间 * ( 1 + 2 + ... + 请求总数-1) / 请求总数 应用到上面的例子: 平均等待时间 = 5ms * (1+2+...+28)/29 = 70ms,和 iostat 给出的78ms 的平均等待时间很接近。这反过来表明 I/O 是同时发起的。 每秒发出的 I/O 请求很多 (约29 个),平均队列却不长 (只有2 个左右),这表明这 29 个请求的到来并不均匀,大部分时间 I/O 是空闲的。 一秒中有 14.29% 的时间 I/O 队列中是有请求的,也就是说,85.71% 的时间里 I/O 系统无事可做,所有 29 个I/O 请求都在142毫秒之内处理掉了。 delta(ruse+wuse)/delta(io) = await = 78.21 =>

Delta (ruse+wuse) / seconds 78.21 * delta (io) / seconds 78.21 * 28.57 = 2232.8, indicating that the total number of 2232.8ms requests per second needs to wait. So the average queue length should be 2232.8ms/1000ms = 2.23, while the average queue length (avgqu-sz) given by iostat is 22.35. Why? Because there are bug,avgqu-sz values in iostat that should be 2.23 instead of 22.35.

With instructions, when I use iostat to test servers, I usually use the iostat-d command. As for the returned results, I usually focus on tps, blk_read/s and blk_wrth/s. I usually compare and test three different models of servers in the same environment, so that the performance differences come out at once.

This is the answer to the question about how iostat tests the IO performance of linux hard disk. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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