views:

1194

answers:

6

I'm sure there's some ancient legacy reason for it, but what is it? It seems like a service that's geared towards reliable data delivery.

A: 

UDP is used when the protocol is going to be managed by the application itself. The app may have a better idea for how to do it, or it may be faster (under the special conditions of the application). TCP is very nice but has a lot of overhead associated with it.

gbarry
A: 

Performance. UDP has a much lower overhead than TCP. On the other hand NFS has to handle reliable transport on its own then (compared to TCP) but as this is a protocol for LANs where connection problems and package drops are (or better: should be) not a problem, it's optimized for performance.

Kosi2801
A: 

My guess is that it's probably for legacy (historical) reasons. Originally NFS was probably used on low latency networks where there was very little possibility of error, so the overhead of initiating the 3-way handshake to set up the TCP connection (together with the bi-directional acknowledgement of all messages) outweighed the simplicity of using a connectionless protocol like UDP.

When UDP is used as a transport protocol, presumably it would be up to the NFS client to manage retransmissions if necessary.

LeopardSkinPillBoxHat
+1  A: 

UDP is the default for NFSv2 (which nobody should really use these days) but NFSv3 use TCP by default. TCP mounts are more reliable and you know you have a network problem much faster than with UDP.

Keltia
+10  A: 
  • NFS was originally designed to be used on a LAN where loss rates are very low.
  • UDP is faster, and has less overhead
  • NFS is stateless, so it's simple for clients to retry

Note that NFS v3+ can use TCP.

dwc
A: 

The stateless UDP connection minimizes network traffic, as the NFS server sends the client a cookie after the client is authorized to access the shared volume. This cookie is a random value stored on the server's side and is passed along with RPC requests from the client.