Transmission Control Protocol TCP Part 2 University of Glamorgan Networked & Distributed Systems
Today’s menu n Establishing A TCP Connection n Timeouts and Retransmission n Congestion n Push n Silly Window Syndrome n Closing A TCP Connection
TCP Connections n There are obviously two end points to a connection n An end point is identified by a combination of host IP address & port number n One end point that initiates the connection. This performs an active open n One end point that accepts the connection. This performs a passive open n The passive open must occur before the active open can succeed n The passive end point can support multiple connections
Establishing A TCP Connection
Timeouts and Retransmission n Selecting the correct value for the timeout is crucial to efficiently implementing TCP.
Round-Trip Time (RTT)
n RTT varies according to ä Different hosts ä Different times of day ä Even from second to second n If we need to retransmit then what is the RTT? ä Time from original transmission to receiving ACK ä Time from last re transmission to receiving ACK
Measuring RTT: Karn’s Algorithm n Ignore retransmission when trying to estimate RTT n Increase timeout value until transmission succeeds n Then recalculate RTT when retransmission no longer needed
Estimating Timeout Value Original Method rtt = ALPHA * rtt + ( 1 – ALPHA ) * sample timeout = BETA * rtt 0 ≤ ALPHA < 1typically 0.9 BETA > 1typically 2 Old New Last Measured value
RTT trajectory using Karn’s Algorithm
RTT: Karn’s Algorithm
Estimating Timeout Value Revised Method diff = sample – rtt rtt = rtt + DELTA * diff dev = dev + RHO * ( abs(diff) – dev ) timeout = rtt + ETA * dev 0 < DELTA < 1typically ⅛ 0 < RHO < 1typically ¼ ETA ≥ 1typically 3
Congestion
Slow-Start (Additive) Recovery When starting a new connection or increasing traffic after congestion is over n congestion window = one segment n for each ACK received n congestion window = congestion window + one segment
Multiplicative Decrease Congestion Avoidance Sender also maintains a congestion window If a segment is lost then congestion window = MIN (congestion window/2, one segment ) allowed window = MIN ( receive window, congestion window ) increase retransmission timer for all segments in allowed window
How does it work?
Exponential Increase Exponential Increase : Increase CW with for each received ACK
How does it work? Can be 64 Kbyte Exponential Increase
How does it work? Exponential Increase : Increase CW with for each received ACK Linear Increase : Increase CW with one for each ACK- ed Window
How does it work? Probably due to loss or congestion Exponential Increase Linear Increase
Push n Normally TCP decides when to send a segment n If user needs to make sure data is sent, they can issue a PUSH
Silly Window Syndrome n Early TCP implementations had problems with the receiver advertising small windows and then the sender sending small segments n Modern implementations avoid this by ä The receiver only advertising zero or “sensible” windows ä Delaying ACKs which would advertise small windows ä Sender only sends when it has a “large” segment or it receives an ACK
Closing A TCP Connection
Next : Higher Layer Protocols n BOOTstrap Protocol (BOOTP) n Dynamic Host Configuration Protocol (DHCP) n Domain Name System (DNS)