HTTP uses TCP as the transport protocol and before user data is sent, TCP 3-way handshake establishes the TCP connection.
So, for each TCP connection, there are 3 packets exchanged and each packet is between 54 and 66 Bytes (notice the Len field). Note that the picture above shows relative sequence (seq) and acknowledgement (ack) numbers.
TCP 3-Way Handshake Overhead
Let’s calculate end-to-end delay, just for fun! As seen in a previous post, the end-to-end delay of a 1,500Byte user data packet is the sum of the transmission delay, propagation delay and any router processing delay. We calculated an end-to-end delay of 68ms.
To break it down a little further, here’s the result for reach segment.
- Segment 1 delay = 26 ms
- Segment 2 delay = 22 ms
- Segment 3 delay = 10 ms
- Router Processing = 10 ms
How does TCP impact performance?
To send that 1,500Byte packet, the TCP session must be established first so to get an overall sense of performance, we also have to include the end-to-end delay of the TCP 3-way handshake. A big difference with the TCP handshake is the packet size is much smaller so we’ll have to calculate the delay for each stage of the handshake using the smaller packet sizes.
TCP Syn Delay
Also, both R1 and R2 each introduce 5 ms of delay so the overall delay to send the TCP Syn segment is 52.79 ms.
TCP Syn-Ack Delay
Since the TCP Syn-Ack packet is the same size at 66 Bytes as the TCP Syn packet, the delay calculation will also come out to 52.79 ms.
TCP Ack Delay
The TCP Ack packet of the 3-way handshake is 54 Bytes, so the delay calculation will be a little lower.
TCP 3-Way Handshake Delay
- TCP Syn: 52.79 ms
- TCP Syn-Ack: 52.79 ms
- TCP Ack: 52.65 ms
Total TCP Handshake Delay: 158.23 ms.
So, when sending a 1,500Byte packet that has an end-to-end delay of 68 ms, the TCP 3-way handshake overhead is approximately 158.23 ms. WOW!
Recognizing this issue, upper layer protocols like HTTP have developed persistence. Persistence allows for multiple packets to be sent over an existing TCP connection, typically based on a keep-alive type of timer.