tcp adaptive retransmission algorithm original tcp
play

TCP Adaptive Retransmission Algorithm - Original TCP Theory - PDF document

TCP Adaptive Retransmission Algorithm - Original TCP Theory Estimate RTT Multiply by 2 to allow for variations Practice Use exponential moving average (A = 0.1 to 0.2) Estimate = (A) * measurement + (1- A) * estimate


  1. TCP Adaptive Retransmission Algorithm - Original TCP Theory  Estimate RTT  Multiply by 2 to allow for variations  Practice  Use exponential moving average (A = 0.1 to 0.2)  Estimate = (A) * measurement + (1- A) * estimate  Problem  Did not handle variations well  Ambiguity for retransmitted packets  Was ACK in response to first, second, etc transmission?  11/11/06 CS/ECE 438 - UIUC, Fall 2006 1 11/11/06 CS/ECE 438 - UIUC, Fall 2006 2 TCP Adaptive Retransmission TCP Adaptive Retransmission Algorithm – Karn-Partridge Algorithm – Jacobson  Algorithm Algorithm  Estimate variance of RTT  Exclude retransmitted packets from RTT  Calculate mean interpacket RTT deviation to approximate variance  estimate Use second exponential moving average  Deviation = (B) * |RTT_Estimate – Measurement| + (1–B) * deviation  For each retransmission  B = 0.25, A = 0.125 for RTT_estimate  Use variance estimate as component of RTT estimate Double RTT estimate   Next_RTT = RTT_Estimate + 4 * Deviation  Exponential backoff from congestion  Protects against high jitter   Problem Notes  Algorithm is only as good as the granularity of the clock  Still did not handle variations well  Accurate timeout mechanism is important for congestion control  Did not solve network congestion problems as  well as desired 11/11/06 CS/ECE 438 - UIUC, Fall 2006 3 11/11/06 CS/ECE 438 - UIUC, Fall 2006 4 TCP Connection Establishment TCP Connection Termination 3-Way Handshake  Message Types  Client Server Client Server Sequence Numbers  Finished (FIN)  J,K  S y listen F n c Acknowledge (ACK) i n h r i s o n  h e i z d Message Types e ( F ( S I N  Y N ) J ) J  Active Close Synchronize (SYN)  SYN K, ACK J+1 acknowledge (ACK) J+1 Acknowledge (ACK)  Sends no more data  Passive Open FIN K   Passive close Server listens for  connection from client Accepts no more data A A C K  C K K K + + 1 1 Active Open  Client initiates connection  Time flows down Time flows down to server 11/11/06 CS/ECE 438 - UIUC, Fall 2006 5 11/11/06 CS/ECE 438 - UIUC, Fall 2006 6 1

  2. TCP Connection Management (cont) TCP State Descriptions CLOSED CLOSED CLOSED CLOSED Disconnected Disconnected Disconnected Disconnected LISTEN LISTEN LISTEN LISTEN Waiting for incoming connection Waiting for incoming connection Waiting for incoming connection Waiting for incoming connection TCP server SYN_RCVD SYN_RCVD SYN_RCVD SYN_RCVD Connection request received Connection request received Connection request received Connection request received lifecycle SYN_SENT SYN_SENT SYN_SENT SYN_SENT Connection request sent Connection request sent Connection request sent Connection request sent ESTABLISHED ESTABLISHED ESTABLISHED ESTABLISHED Connection ready for data transport Connection ready for data transport Connection ready for data transport Connection ready for data transport CLOSE_WAIT CLOSE_WAIT CLOSE_WAIT CLOSE_WAIT Connection closed by peer Connection closed by peer Connection closed by peer Connection closed by peer TCP client LAST_ACK LAST_ACK LAST_ACK Connection closed by peer, closed locally, await ACK Connection closed by peer, closed locally, await ACK Connection closed by peer, closed locally, await ACK LAST_ACK Connection closed by peer, closed locally, await ACK lifecycle FIN_WAIT_1 FIN_WAIT_1 FIN_WAIT_1 FIN_WAIT_1 Connection closed locally Connection closed locally Connection closed locally Connection closed locally FIN_WAIT_2 FIN_WAIT_2 FIN_WAIT_2 FIN_WAIT_2 Connection closed locally and ACK’d Connection closed locally and ACK’d Connection closed locally and ACK’d Connection closed locally and ACK’d CLOSING CLOSING CLOSING CLOSING Connection closed by both sides simultaneously Connection closed by both sides simultaneously Connection closed by both sides simultaneously Connection closed by both sides simultaneously TIME_WAIT TIME_WAIT TIME_WAIT TIME_WAIT Wait for network to discard related packets Wait for network to discard related packets Wait for network to discard related packets Wait for network to discard related packets 11/11/06 CS/ECE 438 - UIUC, Fall 2006 7 11/11/06 CS/ECE 438 - UIUC, Fall 2006 8 TCP State Transition Diagram TCP State Transition Diagram  Questions Active CLOSED open/SYN State transitions  Passive open Close Close Describe the path taken by a server under normal  SYN/SYN + ACK LISTEN conditions Send/SYN SYN_RCVD SYN_SENT Describe the path taken by a client under normal  SYN/SYN + ACK ACK conditions SYN + ACK/ACK Close/ACK Close/FIN ESTABLISHED Describe the path taken assuming the client closes  the connection first FIN/ACK FIN/ACK FIN_WAIT_1 CLOSE_WAIT TIME_WAIT state  What purpose does this state serve ACK CLOSING Close/FIN  FIN + Prove that at least one side of a connection enters FIN_WAIT_2 LAST_ACK  ACK ACK/ACK this state TIME_WAIT ACK FIN/ACK Explain how both sides might enter this state Timeout  CLOSED 11/11/06 CS/ECE 438 - UIUC, Fall 2006 9 11/11/06 CS/ECE 438 - UIUC, Fall 2006 10 TCP State Transition Diagram TCP State Transition Diagram Active Active CLOSED open/SYN open/SYN Passive open Passive open Close Active Close CLOSED open/SYN SYN/SYN + ACK SYN/SYN + ACK LISTEN Passive open Send/SYN Send/SYN Close Close SYN_RCVD SYN_SENT SYN/SYN + ACK SYN/SYN + ACK SYN/SYN + ACK LISTEN ACK ACK Send/SYN SYN + ACK/ACK SYN + ACK/ACK SYN_RCVD SYN_SENT ESTABLISHED SYN/SYN + ACK ACK SYN + ACK/ACK Close/FIN Close/FIN Close/FIN Close/FIN Close/FIN ESTABLISHED TCP A TCP B FIN/ACK FIN/ACK 1. CLOSED LISTEN FIN/ACK FIN/ACK FIN_WAIT_1 CLOSE_WAIT 2. SYN-SENT --> <SEQ=100><CTL=SYN> --> SYN-RECEIVED ACK ACK CLOSING Close/FIN Close/FIN 3. ESTABLISHED <-- <SEQ=300><ACK=101><CTL=SYN,ACK> <-- SYN-RECEIVED FIN + FIN + 4. ESTABLISHED --> <SEQ=101><ACK=301><CTL=ACK> --> ESTABLISHED FIN_WAIT_2 LAST_ACK ACK ACK ACK/ACK ACK/ACK 5. ESTABLISHED --> <SEQ=101><ACK=301><CTL=ACK><DATA> --> ESTABLISHED TIME_WAIT ACK ACK FIN/ACK FIN/ACK Timeout Timeout Timeout Timeout CLOSED 11/11/06 CS/ECE 438 - UIUC, Fall 2006 11 11/11/06 CS/ECE 438 - UIUC, Fall 2006 12 2

  3. TCP Sliding Window Protocol TCP Sliding Window Protocol – Sender Side Sequence numbers LastByteAcked <= LastByteSent   Indices into byte stream  LastByteSent <= LastByteWritten  ACK sequence number  Buffer bytes between LastByteAcked and LastByteWritten  Actually next byte expected as opposed to last byte received  Advertised window  Maximum buffer size Enables dynamic receive window size  Receive buffers  Advertised window Data ready for delivery to application until requested  Out-of-order data out to maximum buffer capacity  Sender buffers  Unacknowledged data  Data available, but Unsent data out to maximum buffer capacity  outside window First unacknowledged byte Last byte sent 11/11/06 CS/ECE 438 - UIUC, Fall 2006 13 11/11/06 CS/ECE 438 - UIUC, Fall 2006 14 TCP Sliding Window Protocol – Receiver Side TCP ACK generation - 1 Maximum buffer size LastByteRead < NextByteExpected  NextByteExpected <= LastByteRcvd + 1  Available buffer size Buffer bytes between NextByteRead and LastByteRcvd  Maximum buffer size Advertised window Next byte expected (ACK value) Next byte to be read by application Buffered, out-of-order data  Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Next byte expected (ACK value)  Delayed ACK. Wait up to 500ms for next segment. Next byte to be read by application 11/11/06 CS/ECE 438 - UIUC, Fall 2006 15 11/11/06 CS/ECE 438 - UIUC, Fall 2006 16 TCP ACK generation - 2 TCP ACK generation - 3 Maximum buffer size Maximum buffer size Available buffer size Available buffer size Next byte expected (ACK value) Next byte expected (ACK value) Next byte to be read by application Next byte to be read by application  Arrival of in-order segment with expected seq #.  Arrival of out-of-order segment higher-than-expect One other segment has ACK pending seq. # Gap detected  Immediately send single cumulative ACK, ACKing both in-  Immediately send duplicate ACK, indicating seq. # of next order segments expected byte 11/11/06 CS/ECE 438 - UIUC, Fall 2006 17 11/11/06 CS/ECE 438 - UIUC, Fall 2006 18 3

Recommend


More recommend