Measure & benchmark the speed & latency of file access on a mounted NFS share
what technique can I use to measure the I/O speed/latency/rate when reading and writing files from that share?
You can use dd
to do this:
# 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
(The file size = bs * count
should be twice of RAM)
or take a look at some benchmark tools: Bonnie++, IOzone, for e.g:
# 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
More details: http://nfs.sourceforge.net/nfs-howto/ar01s05.html
Could this technique also be applied to the local hard drive for comparison purposes?
Sure, you can use it to benchmark the local hard drive for comparing.