我有一个挂载一些NFS共享的Linux Centos系统,当从这个共享中读取和写入文件时,我可以使用什么技术来测量I / O速度/延迟/速率? 这种技术是否也可以应用于本地硬盘进行比较?
在读取和写入共享文件时,可以使用什么技术来测量I / O速度/等待时间/速率?
你可以使用dd来做到这一点:
# time dd if=/dev/zero of=/mnt/nfs/testfile bs=16k count=128k 131072+0 records in 131072+0 records out 2147483648 bytes (2.1 GB) copied, 111.656 seconds, 19.2 MB/s real 1m51.678s user 0m0.066s sys 0m1.482s
# time dd if=/mnt/nfs/testfile of=/dev/null bs=16k 131072+0 records in 131072+0 records out 2147483648 bytes (2.1 GB) copied, 4.96762 seconds, 432 MB/s real 0m4.969s user 0m0.046s sys 0m0.720s
(文件大小= bs * count应该是RAM的两倍)
或者看看一些基准工具: Bonnie ++ , IOzone ,例如:
# bonnie++ -d /mnt/nfs/bonnie/ -s 2048 -r 1024 -u 0 Using uid:0, gid:0. Writing a byte at a time...done Writing intelligently...done Rewriting...done Reading a byte at a time...done Reading intelligently...done start 'em...done...done...done...done...done... Create files in sequential order...done. Stat files in sequential order...done. Delete files in sequential order...done. Create files in random order...done. Stat files in random order...done. Delete files in random order...done. Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP svr201NTC-647.lo 2G 1473 96 46620 3 48033 4 1785 99 3525478 100 +++++ +++ Latency 8647us 86us 268us 5064us 66us 23566us Version 1.96 ------Sequential Create------ --------Random Create-------- svr201NTC-647.local -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 580 2 5742 13 429 2 423 1 7540 12 392 1 Latency 244ms 22747us 4549ms 3849ms 1641us 999ms 1.96,1.96,svr201NTC-647.localdomain,1,1319514624,2G,,1473,96,46620,3,48033,4,1785,99,3525478,100,+++++,+++,16,,,,,580,2,5742,13,429,2,423,1,7540,12,392,1,8647us,86us,268us,5064us,66us,23566us,244ms,22747us,4549ms,3849ms,1641us,999ms
# iozone -aRcU /mnt/nfs/ -f /mnt/nfs/testfile > logfile
更多细节: http : //nfs.sourceforge.net/nfs-howto/ar01s05.html
这种技术是否也可以应用于本地硬盘进行比较?
当然,你可以用它来比较本地硬盘的基准。
也许它可以是有用的: http : //www.alfaexploit.com/ficheros_web/leer.php?id=161
在上面的链接你会发现一个有用的脚本生成1-4Mb之间的文件,这样的读/写速度可以检查。