How to check NFS client performance with nfsiostat

Slow NFS reads or writes can look like a server problem, a client queue, or an application pause until the mounted export is sampled while traffic is actually running. nfsiostat reads /proc/self/mountstats and reports per-mount operation rate, throughput, retransmissions, RPC round-trip time, execution time, queue delay, and errors for mounted NFS filesystems.

The interval form of nfsiostat matters because the first report is cumulative since the export was mounted. Later reports show the activity during each sample interval, which makes them better for checking a short slowdown, a controlled read/write test, or an application window where users report stalls.

Run the check on the affected client and target the exact mount point instead of listing every NFS mount. A clean sample shows operation and throughput rates during the workload, no retransmissions, no errors, and low queue delay; non-zero retransmissions, growing errors, or execution time that rises far above round-trip time should move the investigation to the network, server, or client queue.

Steps to check NFS client performance with nfsiostat:

  1. Confirm that the target path is an NFS mount before reading performance counters.
    $ findmnt --types nfs,nfs4 --target /mnt/projects --output TARGET,SOURCE,FSTYPE,OPTIONS
    TARGET        SOURCE                              FSTYPE OPTIONS
    /mnt/projects files.example.net:/srv/nfs/projects nfs4   rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,proto=tcp

    Replace /mnt/projects with the mounted export path on the client. If findmnt returns no row, mount the export first because nfsiostat only reports mounted NFS filesystems.

  2. Confirm that nfsiostat is available on the client.
    $ command -v nfsiostat
    /usr/sbin/nfsiostat

    On Ubuntu and Debian clients, nfsiostat is installed with the nfs-common package. On Red Hat family clients, it is installed with nfs-utils.

  3. Start an interval report for the target mount while the workload is active.
    $ nfsiostat 1 2 /mnt/projects
    files.example.net:/srv/nfs/projects mounted on /mnt/projects:
    
    ##### snipped #####
    
    files.example.net:/srv/nfs/projects mounted on /mnt/projects:
    
               ops/s       rpc bklog
              82.400           0.000
    
    read:              ops/s            kB/s           kB/op        retrans    avg RTT (ms)    avg exe (ms)  avg queue (ms)          errors
                      48.100        6156.800         128.000        0 (0.0%)           1.420           1.730           0.060        0 (0.0%)
    write:             ops/s            kB/s           kB/op        retrans    avg RTT (ms)    avg exe (ms)  avg queue (ms)          errors
                      34.300        4390.400         128.000        0 (0.0%)           1.830           2.210           0.090        0 (0.0%)

    The first block is cumulative since mount. Read the later interval block when checking current performance.

  4. Generate temporary write traffic from another terminal only when no real workload is available.
    $ dd if=/dev/zero of=/mnt/projects/nfsiostat-test.bin bs=1M count=128 conv=fdatasync
    128+0 records in
    128+0 records out
    134217728 bytes (134 MB, 128 MiB) copied, 2.3 s, 58.4 MB/s

    Use a controlled test only on an export where a temporary file is acceptable. For production incidents, sample the real application workload instead of creating extra write load.

  5. Compare the read and write rows after the first report.

    op/s and kB/s show request rate and throughput, retrans and errors should remain at zero during a clean sample, avg RTT shows server and network response time, avg exe includes client-side completion time, and avg queue shows delay before the request leaves the client.

    Repeated retransmissions or errors during a short sample are failure signals, not normal performance variation. High avg RTT points toward the server or network path, while high avg exe with lower avg RTT points toward client-side wait or queueing.

  6. Remove the temporary test file if the controlled workload step created one.
    $ rm -f /mnt/projects/nfsiostat-test.bin