21.10. Using NFS over TCP
The default transport protocol for NFSv4 is TCP. The advantages of using TCP include the following:
- Improved connection durability, thus less
NFS stale file handles
messages. - Performance gain on heavily loaded networks because TCP acknowledges every packet, unlike UDP which only acknowledges completion.
- TCP has better congestion control than UDP. On a very congested network, UDP packets are the first packets that are dropped. This means that if NFS is writing data (in 8K chunks) all of that 8K must be retransmitted over UDP. Because of TCP's reliability, only parts of that 8K data are transmitted at a time.
- Error detection. When a TCP connection breaks (due to the server being unavailable) the client stops sending data and restarts the connection process once the server becomes available. With UDP, since it's connection-less, the client continues to pound the network with data until the server reestablishes a connection.
The main disadvantage is that there is a very small performance hit due to the overhead associated with the TCP protocol.