Test latency from NFS to a NFS-client

My team opted for a self build NFS server (using an EC2 instance to serve the other instances), instead of using AWS EFS. We would like to test the latency that our NFS has, then to compare it versus the EFS.

Is there a way/tool to test latency of these NFS servers?


The simplest way is to run tshark on the client with options to print rpc response times:

$ tshark -i any -f "port 2049" -Y rpc -Tfields \
   -E separator=/t -E header=y \
   -e frame.number \
   -e rpc.repframe \
   -e rpc.time 
   -e ip.src -e ip.dst \
   -e nfs

The output will be something like:

frame.number    rpc.repframe    rpc.time    ip.src  ip.dst  nfs
Capturing on 'any'
3           x.x.x.x y.y.y.y Network File System, Ops(1): SEQUENCE
4   3   0.000593460 y.y.y.y x.x.x.x Network File System, Ops(1): SEQUENCE
8           x.x.x.x y.y.y.y Network File System, Ops(1): SEQUENCE
9   8   0.000797399 y.y.y.y x.x.x.x Network File System, Ops(1): SEQUENCE

The rpc.time in the reply frame is the difference between sending a request and receiving the reply.

NOTE: the options and output may be different depending tshark version.

Alternatively, you can just collect network traffic with dumpcap or tcpdump and analyze it with the wireshark.