Improve Performance of NFS Mount on Linux

From Bonus Bits
Jump to: navigation, search


This article gives the steps to improve the performance of an NFS mounted shared on Linux. An example is if you have a Plex Media server running on Linux that connects to a NAS over NFS for streaming media that pauses or hangs often. First easy way to determine that it's an NFS issue is to copy a movie local, add to the library and then test it. If it works better or perfect locally then you know you have an NFS issue.


Check NFS Client Statistics

Check the stats on the client side:

nfsstat -rc
Client rpc stats:
calls      retrans    authrefrsh
508387     410          508390

The goal is to have 0 retransmisions.

Check NFS Server Statistics

Check the connection stats on the NFS server:

nfsstat -rs
Server rpc stats:
calls      badcalls   badclnt    badauth    xdrcall
6183151    20         20         0          0

The goal is to have 0 bad calls from the clients.

Update Client Connection

We can set the block size in our mount command in the options, plus set several other options to help with the situation.

  1. Edit /etc/fstab
  2. Before
    nfs-server:/nfsshare /mnt/nfsshare  nfs  auto 0 0
  3. After
    nfs-server:/nfsshare /mnt/nfsshare  nfs  auto,nofail,noatime,nolock,intr,tcp,actimeo=1800,rsize=32768,wsize=32768 0 0

Update Server Thread Count

Generally the default NFS Server Thread Count is 8. We can increase that and should especially when it is highly utilized.

  1. If using a Netgear NAS this can be controlled from the Web Admin Console. Its default for me was 12. I increased it to 24.
  2. One Linux it usually is set in the /etc/sysconfig/nfs configuration file.