« Previous 1 2 3 4 Next »
Useful NFS options for tuning and management
Tune-Up
Timeout and Retransmission
Timeout and retransmission options, although they don't affect performance at first glance, are very important for NFS, especially for the clients. The options determine how long the NFS client waits until retransmitting a packet (timeo
) and how many times an NFS client attempts to resend the packet (retrans
) before restarting the entire process.
The timeo
(timeout) option is the amount of time the NFS client waits on the NFS server before retransmitting a packet (no ACK received). The value for timeo
is given in tenths of a second, so if timeo
is 5
, the NFS client will wait 0.5 seconds before retransmitting. The default is 0.7
(0.07 seconds), but you can adjust the option with the timeo
option of the mount
command or by editing the /etc/fstab
file on the NFS client to indicate the value of timeo
.
The other option, retrans
, specifies the number of tries the NFS client will make to retransmit the packet. If the value is 5
, the client resends the RPC packet five times, waiting timeo
seconds between tries. If, after the last attempt, the NFS server does not respond, you get the message Server not responding
. The NFS client then resets the RPC transmission attempts counter and tries again in the same fashion (same timeo
and retrans
values).
On congested networks, you often see retransmissions of RPC packets. A good way to tell is to run the
nfsstat -r
command and look for the column labeled retrans
. If the number is large, the network is likely very congested. If that is the case, you might want to increase the values of timeo
and retrans
to increase the number of tries and the amount of time between RPC tries. Although taking this action will slow down NFS performance, it might help even out the network traffic so that congestion is reduced. In my experience, getting rid of congestion and dropped packets can result in better, more even performance.
FS-Cache
Something else you might want to consider using to improve NFS client performance is FS-Cache [1], which caches NFS client requests on a local storage device, such as a hard drive or SSD, helping improve NFS read I/O: Data that resides on the local NFS client means the NFS server does not have to be contacted.
To use NFS caching you have to enable it explicitly by adding the option -o fsc
to the mount
command or in /etc/fstab
:
# mount <nfs-share>:/ </mount/point> -o fsc
Any data access to </mount/point>
will go through the NFS cache unless the file is opened for direct I/O or if a write I/O is performed.
The important thing to remember is that FS-Cache only works if the I/O is a read. FS-Cache can't help with a direct I/O (read or write) or an I/O write request. However, there are plenty of cases in which FS-Cache can help. For example, if you have an application that needs to read from a database or file and you are running a large number of copies of the same application, FS-Cache might help, because each node could cache the database or file.
Filesystem-Independent Mount Options
The mount
command in Linux has a number of options that are independent of the filesystem and might be able to improve performance. Some key options are:
noatime
– Inode access times are not updated on the filesystem. This can help performance because the access time of the file is not updated every time a file is accessed.nodiratime
– The directory inode is not updated on the filesystem when it is accessed. This can help performance in the same way as not updating the file access time.relatime
– Inode access times are relative to the modify or change time for the file, so the access time is updated only if the previousatime
(access time) was earlier than the modify or change time.
Before using these options, please read the mount
man page [2]. You also need to decide whether access time is worth tracking accurately. By not tracking it – or not tracking it as accurately – you can increase performance.
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)