Performance improvements on NFS mounts on OpenBSD

2018-11-18

Those are simple notes on how to increase performance (read basically) on my OpenBSD desktop again my NAS at home.

The NAS exports a set of folders via various protocols. AFP for the Macs, NFS for OpenBSD and maybe Linux and Samba for everything else (basically one Ubuntu I use as media center).

It runs FreeBSD, and the performance is generally good on all protocols, limited more or less by the speed of the link 1Gbps but OpenBSD was reporting some low values, in the order of 390Mbps read and 60 Mbps write.

A quick look at the OpenBSD list archives gives me a nice thread that explains a lot.

After some playing around, I applied the following options to the NFS mount points:

-T/-U     To force TCP or UDP respectively, see below
-3        To force NFSv3 (this is unnecessary as is the default)
-a 4      readahead value set to the max. See mount_nfs(8)
-r 32768  readsize. Again see mount_nfs(8)
-w 32768  writesize. same thing.
noatime   I set this up always on network resources.

Oddly enough, I get more stable results (specially on writes) using TCP instead of UDP …

On TCP that read speed is almost saturating the link, ad 890Mbps and write speed is way better (enough for me anyway) at 410Mbps

On UDP read speed is even better around 905Mbps but write speed is poor and inconsistent at about 128Mbps

So in the end I end up using TCP. Maybe I’ll take a closer look in the future to see if I can improve write a little bit, but it’s OK for me at this stage.

Have any comments ? Send an email to the comments address.