Increasing the number of nfsd threads on Linux #linux #nfs

🕥︎ - 2020-02-26

If you have a Linux machine as an NFS server, and you reach some high number of clients, you may see warnings in dmesg along the lines of:

nfsd: too many open connections, consider increasing the number of threads

If you use the error message to search for solutions online, you'll find plenty of explanations saying that you should change the RPCNFSDCOUNT variable in, e.g. /etc/default/nfs-kernel-server on a Debian-based machine.

Sometimes the guides will tell you to restart the nfs-kernel-server-service, but alas, that won't take effect (at least not immediately(?)) Sometimes the suggestion is then to reboot the machine.

Besides being ugly, that might not be convenient, if - say - a whole lot of machines depend on the NFS mount (which is how we got here in the first place!)

I've now found the solution twice, and this time, I am writing it down!

To change the number of nfsd threads to e.g. 16, you run the command:

# rpc.nfsd 16

The change won't persist a reboot, so you'll still have to change the RPCNFSDCOUNT variable, but it will take effect immediately. The number you specify is the desired total number of nfsds.

You can check the number using ps faux | grep [n]fsd | wc -l or looking at the first number in grep ^th /proc/net/rpc/nfsd.

Add comment

To avoid spam many websites make you fill out a CAPTCHA, or log in via an account at a corporation such as Twitter, Facebook, Google or even Microsoft GitHub.

I have chosen to use a more old school method of spam prevention.

To post a comment here, you need to:

¹ Such as Thunderbird, Pan, slrn, tin or Gnus (part of Emacs).

Or, you can fill in this form: