TCP Part 1 Reliable Stream Transport Service D
TCP (Part 1) - Reliable Stream Transport Service D. E. Comer “Internetworking with TCP/IP: Principles, Protocols and Architectures”, Ch. 13, Prentice Hall, 2000 Presented by Ming Su msu 1@sfu. ca
Content o o TCP Introduction Issue in TCP --- Flow Control n n o Sliding window protocol TCP acknowledgement scheme TCP segment TCP timeout Summary 2
TCP Introduction
Introduction - TCP o TCP n n o Transmission Control Protocol TCP is not a software Purpose n n Providing reliable stream delivery Isolating application programs from the details of networking 4
TCP Conceptual Layering Application Reliable Stream (TCP) User Datagram (UDP) Internet (IP), ICMP Network Interface 5
Properties of the reliable delivery service o Stream Orientation n o o Virtual Circuit Connection Buffered Transfer n o o data as a stream of bits, divided into 8 -bit octets transfer more efficiently & minimize network traffic Unstructured Stream Full Duplex Connection n Two-way connection 6
Issues in TCP
Two issues in TCP o Flow Control n n o End-to-end flow control problem Congestion control problem Virtual Circuit Connection 8
Flow Control - Sliding window protocol
End-to-end flow control o Problem n o Sender can send more traffic that receiver can handle. (Too fast) Solution n variable sliding window protocol each acknowledgement, which specifies how many octets have been received, contains a window advertisement that specifies how many additional octets receiver are prepared to accept. 10
Variable Window Size … … Window Advertisement Receiver Transmitter Window Size Value of Window Advertisement Free space in buffer to fill increase bigger increase decrease smaller decrease Stop transmissions 0 full 11
Sliding window protocol in TCP o o o TCP allows the window size to vary over time. Window size changes at the time it slides forward. Advantage: it provides flow control as well as reliable transfer. 12
Flow Control - TCP acknowledgement scheme
Acknowledgements and Retransmission o o Cumulative acknowledgement scheme is used in TCP. A TCP ACK specifies “the sequence number of the next octet that the receiver expects to receive”. 14
Acknowledgements and Retransmission o Adv. n n o Easy to generate and unambiguous. The lost ACKs don’t force retransmission. Disadv. n No information about all successful transmissions for the sender, but only a single position in the stream. 15
Flow Control - TCP segment
TCP segment format 0 4 16 24 31 Source Port Destination Port Sequence Number Acknowledge Number HLEN Reserved Code Bits Window Checksum Urgent Pointer Options (if any) Padding Data … 17
Flow Control - TCP timeout
Timeout and Retransmission o Question n n How to determine timeout? Is the timeout always a constant? 19
Timeout and Retransmission o o An adaptive retransmission algorithm is used in TCP monitors the performance of each connection and adjust its timeout parameter accordingly n o Timeout value may change. Timeout is adjusted when a new round trip sample ( RTT ) is obtained. 20
Timeout and Retransmission o RTT = (α * Old_RTT) + ((1 – α) * new_RTT_sample ) n n n o 0<α<1 α close to 1 => no change in a short time α close to 0 => RTT changes too quickly Timeout = β * RTT n n β >1 Recommended setting, β= 2 21
Accurate Measurement of Round Trip Samples o TCP acknowledgements are ambiguous. n n o It is caused by the cumulative acknowledgement scheme. It happens when retransmission. It causes the question that the first received ACK does correspond the original datagram or the retransmitted datagram. RTT couldn’t be measured accurately if the above question cannot be answered. How to do? 22
Accurate Measurement of Round Trip Samples -- Karn’s Algorithm and Timer Backoff o o Karn’s algorithm: when computing the round trip estimate, ignore samples that correspond to retransmitted segments, but use a back-off strategy, and retain the timeout value from a retransmitted packet for subsequent packets until a valid sample is obtained. Timer back-off strategy: n n New_timeout = γ * timeout ( typically, γ =2 ) Each timer expires (retransmit happens), TCP increases timeout value. 23
Karn’s Algorithm o o Use RTT to compute Timeout When retransmission happens, Timeout increases in γtimes continuously, until transfer successfully. [Backoff strategy] Use the timeout in the final turn of the last step to send next segment. [Backoff strategy] When an acknowledgement arrives corresponding to a segment that did not require retransmission, then TCP re-computes the RTT and reset the timeout accordingly 24
Responding to High Variance in Delay o o Queuing theory: variation in round trip delay is proportional to 1/(1 -L), where L is the current network load, 0<L<1 ( Timeout = β * RTT ) & (β=2 ) => L < 30% n o Not efficient 1989 TCP specification requires to use estimated variance in place of β 25
New RTT and Timeout Algorithm o o DIFF = sample – old_RTT Smoothed_RTT = old_RTT + d * DIFF DEV = old_DEV + p (|DIFF| - old_DEV) Timeout = Smoothed_RTT + g * DEV n n n DEV estimated mean deviation d, a fraction between 0 and 1 to control how quickly the new sample affects the weighted average p, a fraction between 0 and 1 to control how quickly the new sample affects mean deviation g, a factor controls how much deviation affects round trip timeout Research suggests: d=1/8, p=1/4 and g=4 26
Summary o o Purpose of TCP End-end Flow Control issue n n Variable Sliding window protocol in TCP acknowledgement scheme TCP segment TCP timeout o o RTT-Timeout Calculation and Karn’s Algorithm New RTT and Timeout Algorithm 27
Thanks
- Slides: 28