Performance

測量和基準測試已掛載的 NFS 共享上文件訪問的速度和延遲

  • March 16, 2018

我有一個掛載一些 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

這種技術是否也可以應用於本地硬碟驅動器以進行比較?

當然,您可以使用它來對本地硬碟進行基準測試以進行比較。

引用自:https://serverfault.com/questions/324438