为什么 NFS 在版本 4 中从 UDP 切换到 TCP 作为标准协议?

Why did NFS switch from UDP to TCP as the standard protocol in version 4?

为什么 UDP 被用作 NFS 系统的标准协议,直到版本 3 而 TCP 在版本 4 中?不幸的是,我还没有找到任何关于导致这种情况的动机。

Red Hat NFS documentation 提供了一些关于为什么首选 UDP 的见解:

When using NFSv2 or NFSv3 with UDP, the stateless UDP connection under normal conditions has less Protocol overhead than TCP which can translate into better performance on very clean, non-congested networks.

...以及为什么要允许并最终要求 TCP:

However, because UDP is stateless, if the server goes down unexpectedly, UDP clients continue to saturate the network with requests for the server. For this reason, TCP is the preferred protocol when connecting to an NFS server.

The current RFC 还指出 TCP 无需隧道即可促进传输安全:

Historically, NFSv2 and NFSv3 servers have resided on port 2049. The registered port 2049 [RFC3232] for the NFS protocol SHOULD be the default configuration. Using the registered port for NFS services means the NFS client will not need to use the RPC binding protocols as described in [RFC1833]; this will allow NFS to transit firewalls.

为什么是 TCP?实际上,RFC 说 SCTP 也是可以接受的(尽管 TCP 支持是强制性的):

Where an NFSv4 implementation supports operation over the IP network protocol, the supported transport layer between NFS and IP MUST be an IETF standardized transport protocol that is specified to avoid network congestion; such transports include TCP and the Stream Control Transmission Protocol (SCTP). To enhance the possibilities for interoperability, an NFSv4 implementation MUST support operation over the TCP transport protocol.

最后,解决性能,选择 UDP 的最初原因,RFC 说:

If TCP is used as the transport, the client and server SHOULD use persistent connections. This will prevent the weakening of TCP's congestion control via short-lived connections and will improve performance for the Wide Area Network (WAN) environment by eliminating the need for SYN handshakes.

最终,只有 Sun Microsystems 的工程师(as the creators of NFS) know the exact reasons UDP was chosen and only the IETF working group for NFS(作为维护者)知道为什么切换到 TCP。