Transport Area Working Group L. Eggert Internet-Draft Nokia Intended status: Best Current February 26, 2007 Practice Expires: August 30, 2007 UDP Usage Guidelines for Application Designers draft-eggert-tsvwg-udp-guidelines-00 Status of this Memo By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. This document may not be modified, and derivative works of it may not be created, except to publish it as an RFC and to translate it into languages other than English. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on August 30, 2007. Copyright Notice Copyright (C) The IETF Trust (2007). Abstract The User Datagram Protocol (UDP) provides a minimal, message-passing transport that has no inherent congestion control mechanisms. Because congestion control is critical to the stable operation of the Internet, applications and upper-layer protocols that choose to use Eggert Expires August 30, 2007 [Page 1] Internet-Draft UDP Usage Guidelines February 2007 UDP as a transport must employ mechanisms to prevent congestion collapse and establish some degree of fairness with concurrent traffic. This document provides guidelines on the use of UDP for the designers of such applications and upper-layer protocols. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. UDP Usage Guidelines . . . . . . . . . . . . . . . . . . . . . 4 3.1. Congestion Control Guidelines . . . . . . . . . . . . . . 4 3.2. Message Size Guidelines . . . . . . . . . . . . . . . . . 6 3.3. Reliability Guidelines . . . . . . . . . . . . . . . . . . 6 4. Security Considerations . . . . . . . . . . . . . . . . . . . 7 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 7 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7.1. Normative References . . . . . . . . . . . . . . . . . . . 7 7.2. Informative References . . . . . . . . . . . . . . . . . . 8 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 9 Intellectual Property and Copyright Statements . . . . . . . . . . 10 Eggert Expires August 30, 2007 [Page 2] Internet-Draft UDP Usage Guidelines February 2007 1. Introduction The User Datagram Protocol (UDP) [RFC0768] provides a minimal, unreliable, message-passing transport to applications and upper-layer protocols (both simply called "applications" in the remainder of this document). Compared to other transport protocols, UDP is unique in that it does not establish end-to-end connections between communicating end systems. UDP communication consequently does not incur connection establishment and teardown overheads and there is no associated end system state. Because of these characteristics, UDP can offer a very efficient communication transport to some applications. A second unique characteristic of UDP is that it provides no inherent congestion control mechanisms. [RFC2914] describes the best current practice for congestion control in the Internet. It identifies two major reasons why congestion control mechanisms are critical for the stable operation of the Internet: 1. The prevention of congestion collapse, i.e., a state where an increase in network load results in a decrease in useful work done by the network. 2. The establishment of a degree of fairness, i.e., allowing multiple flows to share the capacity of a path reasonably equitably. Because UDP itself provides no congestion control mechanisms, it is up to the applications that use UDP to employ suitable mechanisms to prevent congestion collapse and establish a degree of fairness. [RFC2309] discusses the dangers of congestion-unresponsive flows and states that "all UDP-based streaming applications should incorporate effective congestion avoidance mechanisms." This is an important requirement, even for applications that do not use UDP for streaming. For example, an application that generates five 1,500-octet UDP packets in one second can already exceed the capacity of a 56Kb/s path. For applications that can operate at higher, potentially unbounded data rates, congestion control becomes vital. Section 3 describes a number of simple guidelines for the designers of such applications. A UDP message is carried in a single IP packet and is hence limited to a maximum payload of 65,487 octets. The transmission of large IP packets frequently requires IP fragmentation, which decreases communication reliability and efficiency and should be avoided [I-D.heffner-frag-harmful]. Some of the guidelines in Section 3 describe how applications should determine appropriate message sizes. Eggert Expires August 30, 2007 [Page 3] Internet-Draft UDP Usage Guidelines February 2007 This document focuses on providing guidelines to designers of applications that use UDP for unicast transmission. A special class of applications uses UDP for IP multicast transmissions. Congestion control of multicast transmissions is more difficult than controlling unicast transmissions, because a single sender may transmit to multiple receivers across potentially very heterogeneous paths at the same time. Designing multicast applications requires congestion control expertise that goes beyond the simple guidelines given in this document. The IETF has defined a reliable multicast framework [RFC3048] and several building blocks to aid the designers of multicast applications, such as [RFC3738] or [RFC4654]. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14, RFC 2119 [RFC2119]. 3. UDP Usage Guidelines The RECOMMENDED alternative to the UDP usage guidelines described in this section is the use of a transport protocol that is congestion- controlled, such as TCP [RFC0793], SCTP [RFC2960] or DCCP [RFC4340]. Congestion control mechanisms are difficult to implement correctly, and for most applications, the use of one of the existing, congestion-controlled protocols is the simplest method of satisfying [RFC2914]. If used correctly, congestion-controlled transport protocols are not as "heavyweight" as often claimed. For example, TCP with SYN cookies [I-D.ietf-tcpm-syn-flood], which are available on many platforms, does not require a server to maintain per-connection state until the connection is established. Similarly, well-designed applications can shift maintenance of the TIME-WAIT state after a connection ends to the client. Finally, TCP's built-in capacity-probing and PMTU awareness results in efficient data transmission that quickly compensates for the initial connection setup delay, for transfers that exchange more than a few packets. 3.1. Congestion Control Guidelines If an application or upper-layer protocol chooses not to use a congestion-controlled transport protocol, it SHOULD control the rate at which it sends UDP messages to a destination, using one of the approaches discussed in this section. Eggert Expires August 30, 2007 [Page 4] Internet-Draft UDP Usage Guidelines February 2007 It is important to note that congestion control should not be viewed as an add-on to a finished application. Many of the mechanisms discussed in the guidelines below require application support to operate correctly. Application designers need to consider congestion control throughout the design of their application, similar to how they consider security aspects throughout the design process. Applications that perform bulk transmission of data to a peer over UDP SHOULD consider implementing TCP-Friendly Rate Control (TFRC) [RFC3448], or otherwise ensure that the application complies with the congestion control principles. TFRC has been designed to provide both congestion control and fairness in a way that is compatible with the IETF's other transport protocols. If an application implements TFRC, it need not follow the remaining guidelines in this section, but SHOULD still follow the guidelines on message sizes in Section 3.2. Note that TFRC is currently being updated [I-D.ietf-dccp-rfc3448bis], and application designers SHOULD always evaluate whether the latest published specification fits their needs. Applications that exchange only a small number of messages with a destination at any time may not benefit from implementing TFRC. Such applications SHOULD still control their transmission behavior by not sending more than one UDP message per round-trip time (RTT) to a destination. The scheme described here is similar to the recommendation in [RFC1536] and requires applications to maintain an estimate of the RTT for a destination it communicates with. Applications SHOULD implement the algorithm specified in [RFC2988] to compute a smoothed RTT (SRTT) estimate. A lost response from the peer SHOULD be treated as a very large RTT sample, instead of ignoring it, in order to cause a sufficiently large (exponential) back-off. When implementing this scheme, applications need to choose a sensible initial value for the RTT. This value SHOULD generally be as conservative as possible for the given application. For example, SIP [RFC3261] and GIST [I-D.ietf-nsis-ntlp] use an initial value of 500 ms. Some applications cannot maintain a reliable RTT estimate for a destination. The first case is applications that exchange too few messages with a peer to establish a statistically accurate RTT estimate. Such applications MAY use a fixed transmission interval that is exponentially backed-off during loss. For example, SIP [RFC3261] and GIST [I-D.ietf-nsis-ntlp] use an interval of 500 ms. A second class of applications cannot maintain an RTT estimate for a destination, because the destination does not send return traffic. Such applications SHOULD NOT send more than one UDP message every 3 seconds. The 3-second interval was chosen based on TCP's retransmission timeout when the RTT is unknown [RFC2988]. Note that Eggert Expires August 30, 2007 [Page 5] Internet-Draft UDP Usage Guidelines February 2007 this interval needs to be more conservative than in the cases above, because the lack of return traffic prevents the detection of packet loss, i.e., congestion events, and the application therefore cannot perform exponential back-off to reduce load. Applications that communicate bidirectionally SHOULD employ congestion control for both directions of the communication. For example, for a client-server, request-response-style application, clients SHOULD congestion control their request transmission to a server, and the server SHOULD congestion control its responses to the clients. 3.2. Message Size Guidelines Because IP fragmentation lowers the efficiency and reliability of Internet communication [I-D.heffner-frag-harmful], an application SHOULD NOT send UDP messages that result in IP packets that exceed the path MTU (PMTU) to the destination host. Consequently, an application SHOULD implement path MTU discovery [RFC1191][RFC1981][I-D.ietf-pmtud-method] to determine the maximum message size for each destination they communicate with. Applications that choose to not implement path MTU discovery SHOULD NOT send UDP messages that exceed the minimum PMTU. The minimum PMTU depends on the IP version used for transmission, and is the lesser of 576 octets and the first-hop MTU for IPv4 [RFC1122] and 1280 octets for IPv6 [RFC2460]. To determine an appropriate UDP payload size, applications must subtract IP header and option lengths as well as the length of the UDP header from the PMTU size. Transmission of minimum-sized messages is inefficient over paths that support a larger PMTU, which is a second reason to implement PMTU discovery. 3.3. Reliability Guidelines Application designers are generally aware that UDP does not provide any reliability. Often, this is a main reason to consider UDP as a transport. Applications that do require reliable message delivery SHOULD implement an appropriate mechanism themselves. UDP does also not protect against message duplication, i.e., an application may receive multiple copies of the same message. Application designers SHOULD consider whether their application handles message duplication gracefully, and may need to implement mechanisms to detect duplicates. Even if message reception triggers idempotent operations, applications may want to suppress duplicate messages to reduce load. Finally, UDP messages may be reordered in the network and arrive at Eggert Expires August 30, 2007 [Page 6] Internet-Draft UDP Usage Guidelines February 2007 the received in an order different from the send order. Applications that require ordered delivery SHOULD reestablish message ordering themselves. 4. Security Considerations [RFC2309] and [RFC2914] discuss the dangers of congestion- unresponsive flows to the Internet. This document provides guidelines to designers of UDP-based applications to congestion- control to their transmissions. As such, it does not raise any additional security concerns. 5. IANA Considerations This document raises no IANA considerations. 6. Acknowledgments Thanks to Mark Allman, Joerg Ott, Pasi Sarolahti and Magnus Westerlund for their comments on this document. 7. References 7.1. Normative References [I-D.ietf-pmtud-method] Mathis, M. and J. Heffner, "Packetization Layer Path MTU Discovery", draft-ietf-pmtud-method-11 (work in progress), December 2006. [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August 1980. [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, September 1981. [RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, November 1990. [RFC1981] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery for IP version 6", RFC 1981, August 1996. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. Eggert Expires August 30, 2007 [Page 7] Internet-Draft UDP Usage Guidelines February 2007 [RFC2914] Floyd, S., "Congestion Control Principles", BCP 41, RFC 2914, September 2000. [RFC2960] Stewart, R., Xie, Q., Morneault, K., Sharp, C., Schwarzbauer, H., Taylor, T., Rytina, I., Kalla, M., Zhang, L., and V. Paxson, "Stream Control Transmission Protocol", RFC 2960, October 2000. [RFC2988] Paxson, V. and M. Allman, "Computing TCP's Retransmission Timer", RFC 2988, November 2000. [RFC3448] Handley, M., Floyd, S., Padhye, J., and J. Widmer, "TCP Friendly Rate Control (TFRC): Protocol Specification", RFC 3448, January 2003. [RFC4340] Kohler, E., Handley, M., and S. Floyd, "Datagram Congestion Control Protocol (DCCP)", RFC 4340, March 2006. 7.2. Informative References [I-D.heffner-frag-harmful] Heffner, J., "IPv4 Reassembly Errors at High Data Rates", draft-heffner-frag-harmful-04 (work in progress), January 2007. [I-D.ietf-dccp-rfc3448bis] Handley, M., "TCP Friendly Rate Control (TFRC): Protocol Specification", draft-ietf-dccp-rfc3448bis-00 (work in progress), October 2006. [I-D.ietf-nsis-ntlp] Schulzrinne, H. and R. Hancock, "GIST: General Internet Signaling Transport", draft-ietf-nsis-ntlp-11 (work in progress), August 2006. [I-D.ietf-tcpm-syn-flood] Eddy, W., "TCP SYN Flooding Attacks and Common Mitigations", draft-ietf-tcpm-syn-flood-01 (work in progress), December 2006. [RFC1122] Braden, R., "Requirements for Internet Hosts - Communication Layers", STD 3, RFC 1122, October 1989. [RFC1536] Kumar, A., Postel, J., Neuman, C., Danzig, P., and S. Miller, "Common DNS Implementation Errors and Suggested Fixes", RFC 1536, October 1993. [RFC2309] Braden, B., Clark, D., Crowcroft, J., Davie, B., Deering, Eggert Expires August 30, 2007 [Page 8] Internet-Draft UDP Usage Guidelines February 2007 S., Estrin, D., Floyd, S., Jacobson, V., Minshall, G., Partridge, C., Peterson, L., Ramakrishnan, K., Shenker, S., Wroclawski, J., and L. Zhang, "Recommendations on Queue Management and Congestion Avoidance in the Internet", RFC 2309, April 1998. [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 2460, December 1998. [RFC3048] Whetten, B., Vicisano, L., Kermode, R., Handley, M., Floyd, S., and M. Luby, "Reliable Multicast Transport Building Blocks for One-to-Many Bulk-Data Transfer", RFC 3048, January 2001. [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, June 2002. [RFC3738] Luby, M. and V. Goyal, "Wave and Equation Based Rate Control (WEBRC) Building Block", RFC 3738, April 2004. [RFC4654] Widmer, J. and M. Handley, "TCP-Friendly Multicast Congestion Control (TFMCC): Protocol Specification", RFC 4654, August 2006. Author's Address Lars Eggert Nokia Research Center P.O. Box 407 Nokia Group 00045 Finland Phone: +358 50 48 24461 Email: lars.eggert@nokia.com URI: http://research.nokia.com/people/lars_eggert/ Eggert Expires August 30, 2007 [Page 9] Internet-Draft UDP Usage Guidelines February 2007 Full Copyright Statement Copyright (C) The IETF Trust (2007). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Intellectual Property The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org. Acknowledgment Funding for the RFC Editor function is provided by the IETF Administrative Support Activity (IASA). Eggert Expires August 30, 2007 [Page 10]