Linux: Tune NFS Performance

What values can be tuned to improve NFS performance? How do I improve my client performance under Linux operating systems?

ADVERTISEMENTS

The mount command (mount.nfs4 and mount.nfs) allows you to fine tune NFS mounting to improve NFS server and client performance. However, there is no one-size-fits-all approach to NFS performance tuning. Servers can be configured for handling different workloads and may need to be tuned as per your setup. Please test and monitor both your server and client systems as you test different tuning options.

Recommended NFS Tuning Options For the Mount Command

  • noacl: Disables Access Control List (ACL) processing.
  • nocto: Suppress the retrieval of new attributes when creating a file.
  • rsize: The number of bytes NFS uses when reading files from an NFS server. The rsize is negotiated between the server and client to determine the largest block size that both can support. The value specified by this option is the maximum size that could be used; however, the actual size used may be smaller. Note: Setting this size to a value less than the largest supported block size will adversely affect performance.
  • wsize: The number of bytes NFS uses when writing files to an NFS server. The wsize is negotiated between the server and client to determine the largest block size that both can support. The value specified by this option is the maximum size that could be used; however, the actual size used may be smaller. Note: Setting this size to a value less than the largest supported block size will adversely affect performance.
  • noatime: Setting this value disables the NFS server from updating the inodes access time. As most applications do not necessarily need this value, you can safely disable this updating.
  • nodiratime: Setting this value disables the NFS server from updating the directory access time. This is the directory equivalent setting of noatime.
  • noac: Disable all forms of attribute caching entirely. This extracts a significant performance penalty but it allows two different NFS clients to get reasonable results when both clients are actively writing to a common export on the server.

Here is sample mount command with the above options:
# mount.nfs -o noacl,nocto, rsize=32768,wsize=32768 nfsserver:/sales /salesdata/

For more information read your local nfs and mount command man pages. Please note that most of the above options are also supported by other UNIX like operating systems such as OpenBSD, FreeBSD, AIX and so on.

This entry is 8 of 15 in the Linux / UNIX NFS File Server Tutorial series. Keep reading the rest of the series:
  1. CentOS / Redhat: Setup NFS v4.0 File Server
  2. Debian / Ubuntu Linux: Setup NFSv4 File Server
  3. Mac Os X: Mount NFS Share / Set an NFS Client
  4. RHEL: How Do I Start and Stop NFS Service?
  5. How To Restart Linux NFS Server Properly When Network Become Unavailable
  6. Linux Iptables Allow NFS Clients to Access the NFS Server
  7. Debian / Ubuntu Linux Disable / Remove All NFS Services
  8. Linux: Tune NFS Performance
  9. Mount NFS file system over a slow and busy network
  10. Linux Track NFS Directory / Disk I/O Stats
  11. Linux Disable / Remove All NFS Services
  12. Linux: NFS4 mount Error reason given by server: No such file or directory
  13. Linux NFS Mount: wrong fs type, bad option, bad superblock on fs2:/data3 Error And Solution
  14. CentOS / RHEL CacheFS: Speed Up Network File System (NFS) File Access
  15. Increase NFS Client Mount Point Security
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
6 comments… add one
  • Greg Jun 15, 2012 @ 2:03

    # mount.nfs -o noacl,nocto, rsize=32768,wsize=32768 nfsserver:/sales /salesdata/
    I copy your command except the rsize and wsize. My NFS default is rsize=1048576,wsize=1048576, the result is actually worse than mount it directly with mount nfsserver:/sales /salesdata/
    It is not optimized, but worse. Do you know why?

    Thanks

  • Marco Jul 12, 2012 @ 5:55

    If your MTU is much smaller then I would expect the nfs packets to get fragmented and need to go through reassembly at the other end.

    HTH

  • zaff Mar 15, 2013 @ 11:33

    I have netapp filesystem mount on my linux host and i have specify below perameter in fstab file. But perfomace is not good and slow. Could you please tell me which would be the right perameter to increase my disk read & write performance ?

    rw,fg,hard,rsize=32768,wsize=32768,vers=3,nointr,timeo=600,tcp

    Your quick response is appreciated.

  • et0n1c Dec 2, 2013 @ 13:24

    Zaff,

    I would try to use UDP instead of TCP and see if that makes a difference.
    Also, try rw,no_root_squash,no_all_squash,async,insecure,no_subtree_check,nohide for options. That’s always worked great for us.

    Tonic, Affordable Hosting @ etonic.net

  • Dogan YILMAZ Jun 3, 2015 @ 9:59

    I am using my nfs server with these parameters: rw,bg,hard,noatime,nolock,rsize=32768,wsize=32768,nfsvers=3,intr,tcp,actimeo=0

  • FMa Jan 15, 2016 @ 2:56

    (1) What kind of files, e.g., dbms, compressed graphics files, etc. are you storing on the NFS mount?

    (2) What is the network connectivity of the linux host system, e.g., 100 Mbps, 1 GbE, 10 GbE? Jumbo frame, i.e., MTU 9000?

    (3) Unless you’re sharing the contents of the NFS mount between 2 or more host systems and absolutely require instant update of changes, remove the actimeo=0 mount option. If you want faster update between the host system but not as much of a penalty on performance, set actimeo to something lower than the default but higher than 0, e.g., 5, 10, etc.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.