Yesterday I started to write about network performance. When talking about the Internet, we can’t forget the protocols which are the driving force of the Internet. We can divide the entire architecture in to few layers and study it by layers. According to the TCP architecture, there are 5 layers in a network,

  1. Application Layer
  2. Transport Layer – TCP/UDP
  3. Network Layer – IP
  4. Data Link Layer
  5. Physical Layer

Here I have mentioned the protocols in the transport layer and the network layer as well. So let’s talk about TCP and UDP from this text as Transport Layer Protocols.


Transmission Control Protocol or TCP is the main protocol used these days in the Transport Layer. We can take IP with TCP and then it is known as TCP/IP. Let’s see some of the characteristics of the TCP protocol,

  1. Connection oriented.
  2. Reliable data transmission.
  3. Error handling.
  4. Not the fastest.
  5. Retransmission of lost data.
  6. In-order delivery.
  7. Congestion control and avoidance.
  8. Data integrity.
  9. Preserve the order of delivery.
  10. Use three way handshaking.

Because of these characteristics, TCP is good for transmission of data which need a reliability rather than concerning about the speed of the delivery. For example,

  • World Wide Web.
  • Email.
    • SMTP
    • IMAP/POP
  • File transfers.
    • SSH
    • FTP
    • Telnet

Those are few examples of TCP in real life. When talking about the characteristics of TCP, I mentioned it as a connection oriented protocol and also it uses three way hand shaking. Let’s see what does that mean.


All TCP connections begin with a three-way handshake. Before the client or the server can exchange any application data, they must agree on starting packet sequence numbers, as well as a number of other connection specific variables, from both sides. The sequence numbers are picked randomly from both sides for security reasons. Using this handshaking procedure they will establish a connection between the client and server before sending data. Because of this connection we can say it’s a connection oriented protocol as well as it’s reliable.

  • SYN : Client picks a random sequence number x and sends a SYN packet, which may also include additional TCP flags and options.
  • SYN ACK : Server increments x by one, picks own random sequence number y , appends its own set of flags and options, and dispatches the response.
  • ACK : Client increments both x and y by one and completes the handshake by dispatching the last ACK packet in the handshake.


The time taken for this three way hand shaking procedure makes the TCP more time consuming at the setup. So it’s good to reduce the new setups and reuse the existing once. Also because of this late at the startup, the Latency of TCP is much more greater than the UDP. But after all it provides a reliable data transmission.


As I told earlier, latency is the greatest drawback of the TCP protocol. But we can use some optimizations and make the delay reduce to get the best performance out of the protocol. Let’s see what we can do,

  1. Increase TCP’s initial congestion window.
  2. Disable slow start.
  3. Enable window scaling.
  4. Allows application data to be sent in the initial SYN packet in certain situations.
  5. Use the latest kernel.
  6. No bit is faster than one that is not sent; send fewer bits.
  7. Compress the transferred data.
  8. Reuse the TCP connection.


User Datagram Protocol or the UDP is the second protocol which can be used in the Transport Layer as a replacement for the TCP protocol. Let’s see some of the characteristics of the UDP protocol,

  1. Connection less protocol.
  2. No reliability in the transmission.
  3. No error handling.
  4. Provide the fastest transmission.
  5. Don’t preserve the order of the delivery.
  6. No retransmission.

Because of these characteristics, UDP is good for transmission of data which need real time delivery of data without concerning about the reliability of the transmission. For example,

  • Tunneling/VPN
  • Media streaming
  • Games
  • Local broadcast mechanisms

Those are few examples of UDP in real life. udp.jpg


Let’s see some of the optimizations which we can used to make our UDP protocol works efficient.

  • Application must tolerate a wide range of Internet path conditions.
  • Application should control rate of transmission.
  • Application should perform congestion control over all traffic.
  • Application should use bandwidth similar to TCP.
  • Application should back off retransmission counters following loss.
  • Application should not send datagrams that exceed path MTU.
  • Application should handle datagram loss, duplication, and reordering.
  • Application should be robust to delivery delays up to 2 minutes.
  • Application should enable IPv4 UDP checksum, and must enable IPv6 checksum.
  • Application may use keepalives when needed (minimum interval 15 seconds).

Hope now you have a clear idea about these two transport layer protocols and how to optimize them to get the best performance out of them. See you soon with another important topic. Thank You!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s