How to tune nconnect to improve NFS performance

The nfs mount option “nconnect=n” exists in all Linux distributions with kernel 5.3 or higher. nconnect enables multiple TCP connections for a single NFS mount.

From the nfs manual page:

nconnect=n

When using a connection oriented protocol such as TCP, it may sometimes be advantageous to set up multiple connections between the client and server. For instance, if your clients and/or servers are equipped with multiple network interface cards (NICs), using multiple connections to spread the load may improve overall performance. In such cases, the nconnect option allows the user to specify the number of connections that should be established between the client and server up to a limit of 16.

The nconnect option can be easily added during nfs mount as the following command.

1
$ mount -t nfs -o nconnect=16 nfs-server-hostname:/mnt/nfsshare /mnt/nfsmnt1 		

The following is the 4k sequential write performance comparison by increasing nconnect to 16 over a single 10GbE link.

Image

Reference