06-02-2013, 11:26 AM
Study of UDP performance
Introduction
Most network games use the User Datagram Protocol (UDP) as the underlying transport
protocol. The Transport Control Protocol (TCP), which is what most Internet traffic relies
on, is a reliable connection-oriented protocol that allows datastreams coming from a
machine connected to the Internet to be received without error by any other machine on
the Internet. UDP however, is an unreliable connectionless protocol that does not
guarantee accurate or unduplicated delivery of data.
Why do games use UDP?
TCP has proved too complex and too slow to sustain real-time game-play. UDP allows
gaming application programs to send messages to other programs with the minimum of
protocol mechanism. Games do not rely upon ordered reliable delivery of data streams.
What is more important to gaming applications is the prompt delivery of data. UDP
allows applications to send IP datagrams to other applications without having to establish
a connection and than having to release it later, which increases the speed of
communication. UDP is described in RFC 768.
The UDP segment shown above consists of an 8-byte header followed by the data octets.
Fields
The source and destination ports identify the end points within the source and destination
machines.
The source port indicates the port of the sending process and unless otherwise stated it is
the port to which a reply should be sent to. A zero is inserted into it if it is not used.
The UDP Length field shows the length of the datagram in octets. It includes the 8-byte
header and the data to be sent.
The UDP checksum field contains the UDP header, UDP data and the pseudo-header
shown above. The pseudo-header contains the 32-bit IP addresses of the source and
destination machines, the UDP protocol number and the byte count for the UDP segment.
The pseudo-header helps to find undelivered packets or packets that arrive at the wrong
address. However the pseudo-header violates the protocol hierarchy because the IP
addresses which are used in it belong to the IP layer and not to the UDP layer.
UDP Latency
While TCP implements a form of flow control to stop the network from flooding there is
no such concept in UDP. This is because UDP does not rely on acknowledgements to
signal successful delivery of data. Packets are simply transmitted one after another with
complete disregard to event of the receiver being flooded.
The effects of UDP
As mentioned before the majority of the traffic on the Internet relies on TCP. With the
explosive increase in the amount of gaming taking place on the Internet, and with most of
these games using UDP, there are concerns about the effects that UDP will have on TCP
traffic.
A study carried out in the University of Waikato in New Zealand suggests that UDP
traffic has a negative effect on TCP throughput. UDP is now seen as being aggressive to
'network friendly applications deploying adaptive congestion control'.
While TCP implements a form of flow control to stop the network from flooding there is
no such concept in UDP. This is because UDP does not rely on acknowledgements to
signal successful delivery of data. Packets are simply transmitted one after another with
complete disregard to event of the receiver being flooded. UDP affects TCP throughput
in much the same way as digitized speech over IP does. The study shows that UDP
behaves in much the same way regardless of what application is running it.
UDP Broadcast Flooding
A broadcast is a data packet that is destined for multiple hosts. Broadcasts can occur at
the data link layer and the network layer. Data-link broadcasts are sent to all hosts
attached to a particular physical network. Network layer broadcasts are sent to all hosts
attached to a particular logical network. The Transmission Control