我有一个 Linux Centos 系统,其中挂载了一些 NFS 共享,我可以使用什么技术来测量从该共享读取和写入文件时的 I/O 速度/延迟/速率?此技术是否也可以应用于本地硬盘以进行比较?
答案1
我可以使用什么技术来测量从该共享读取和写入文件时的 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++ -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
为了进行比较,这种技术是否也可以应用于本地硬盘?
当然,您可以使用它来对本地硬盘进行基准测试并进行比较。