1 / 23

TCP Timeout and Retransmission

TCP Timeout and Retransmission. 2005. 5. 2( 월 ) 이 병 희 icebyung@hufs.ac.kr. Introduction. TCP provides a reliable transport Each end send acknowledgment to the other end when receive data Data and acknowledgment can get lost

terris
Download Presentation

TCP Timeout and Retransmission

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TCP Timeout andRetransmission 2005. 5. 2(월) 이 병 희 icebyung@hufs.ac.kr

  2. Introduction • TCP provides a reliable transport • Each end send acknowledgment to the other end when receive data • Data and acknowledgment can get lost • TCP handles this by setting a timeout when it sends data and retransmits data • TCP manages four different timers • retransmission timer • persist timer • keepalive timer • 2MSL timer

  3. RTT Measurement • Timeout should be based on Round-trip time (RTT) • RTT measured by observing difference between time of transmission and arrival of acknowledgment SRTT = αSRTT + (1 – α)RTT RTO = β SRTT • It can’t keep up with wide fluctuations in the RTT • causing unnecessary retransmissions • RTO measurement in RFC1122 • Err = RTT – SRTT • SRTT = SRTT + gErr • D = D + h( |Err| - D) • RTO = SRTT + 4D

  4. RTT Measurement Example • The timer increment a counter every time the 500ms • The starting Seq number is remembered

  5. Karn’s Algorithm • When timeout occurs and packet is retransmitted • 송신 호스트는 RTT연산에 대해 혼선 • Is the ACK for the first transmission or second ? • Do not update the RTT until an ACK is received for a segment that was not retransmitted • if TCP timestamp option is used, we don’t need to apply Karn’s Algorithm Segment1, Seq =1010 Segment1, Seq =1010 Segment1 Retransmission ACK, Seq=1010

  6. Congestion Avoidance Algorithm • assumption of the algorithm • packet loss caused by damage is very small • the loss of a packet signals congestion • Congestion Avoidance and Slow Start algorithm • Initialization of the connection sets cwnd to one and ssthresh to 65535bytes • When congestion occurs, one-half of the current window size is saved in ssthresh. If congestion is indicated by timeout, cwnd is set to one. • When new data is acknowledged by the other end, cwnd is increased

  7. Congestion Avoidance Algorithm • If cwnd is less than or equal to ssthresh, doing slow start. otherwise doing congestion avoidance. • slow start has cwnd start at one segment, and be incremented by one segment every time an ACK is received • congestion avoidance dictates that cwnd be incremented by 1/cwnd each time an ACK is received

  8. Fast Retransmit and Fast Recovery • Fast Retransmission • If Sender receive three or more duplicate ACK in a row, Sender retransmit the missing segment without waiting for a retransmission timer to expire • Fast Recovery • After fast retransmission, sender do congestion avoidance • Set ssthresh to one-half of the minimum of current cwnd and receiver’s advertised window • Set cwnd to ssthresh + 3(segment size) • Each time another duplicate ACK arrives, increment cwnd by the segment size and transmit packet • When the next ACK arrives that acknowledges new data set cwnd to ssthresh

  9. Congestion example • segment 45 got lost • Receiver send duplicated ACK • Sender get three duplicated ACKs in a row • Sender starts fast retransmission

  10. TCP Persist Timer

  11. TCP Persist Timer • When window size goes to ‘0’, Sender stops transmitting data until the window becomes nonzero • If an ACK is lost, both sender and receiver are waiting for the other • To prevent deadlock, sender use persist timer 7169:8193(1024) ack1 win 4096 8193:9217(1024) ack1 win 4096 ACK 9217 win 0 ACK 9217 win 4096

  12. TCP Persist Timer • After segment13, sender set persist timer • If sender doesn’t receive window update when timer expire, it send window probes bsdi svr4 (11) (12) (13) persist timer start send window probes (14) (15)

  13. Silly Window Syndrome • It can be caused by either side • Receiver advertise small size windows • Sender transmit small amount of data • Ways to prevent silly window syndrome • Receiver side • must not advertise small window • use delay ACK • Sender side • must not transmit data until full-size or at least one-half of maximum window size • sender can send everything when we are not excepting an ACK

  14. sun.1069 bsdi.7777 PSH 1:1025(1024) ack 1, win 4096 0.0 0.002026(0.0020) 0.003737(0.0017) 0.005361(0.0016) 0.170306(0.1649) 5.151768(4.9815) 5.170308(0.0185) 10.151592(4.9813) 10.170299(0.0187) 15.151466(4.9812) 15.170296(0.0188) 1 PSH 1025:2049(1024) ack 1, win 4096 2 PSH 2049:3073(1024) ack 1, win 4096 3 PSH 3073:4097(1024) ack 1, win 4096 4 ack 4097,win 0 5   4097:4098(1) ack 1, win 4096 6 ack 4098, win 0 7   4098:4099(1) ack 1, win 4096 8 ack 4099, win 0 9   4099:4100(1) ack 1, win 4096 10 ack 4100, win 1533 11 SWS example

  15. bsdi.7777 sun.1069 4100:5124(1024) ack 1, win 4096 15.172006(0.0017) 15.370307(0.1983) 20.151782(4.7815) 20.170297(0.0185) 25.151162(4.9809) 25.170302(0.0191) 25.171801(0.0015) 25.174401(0.0026) 39.991658(14.8173) 51.991775(12.0001) 51.992665(0.0009) 12 ack 5124, win 509 13   5124:5633(509) ack 1, win 4096 14 ack 5633, win 0 15   5633:5634(1) ack 1, win 4096 16 ack 5634, win 1279 17 FIN, PSH 5634:6145(511) ack 1, win 4096 18 ack 6146, win 767 19   ack 6146, win 2816 20 FIN 1:1(0) ack 6146, win 4096 21   ack 2, win 4096 22 SWS example

  16. SWS example

  17. SWS example

  18. TCP Keepalive Timer

  19. TCP Keepalive Timer • Introduction • If there are no data exchange between TCP connection, the connection remains established • Even if intermediate routers are crashed or lines are down, the connection remains established • Keepalive option provides capability that server can know whether client is down • If intermediate router has crashed, keepalive will think that the client is down and terminate connection

  20. Description • States of client and server • If there is no activity for two hours, the server sends a probe segment to the client

  21. Keepalive Example • Other End Crashes bsdi % sock –K svr4 echo hello, world hello, world - disconnect cable –(4 hours later) read error: Connection timed out first keepalive probe (2 hours later) second keepalive probe (4 hours later)

  22. Keepalive Example • Other End Crashes and Reboot bsdi % sock –K svr4 echo hi there hi there read error: Connection reset by peer first keepalive probe (2 hours later)

  23. Server Client Terminate the connection Router (down) Router (alive) Keepalive Example • Other End is Unreachable slip % sock –K vangogh.cs.berkeley.edu echo testing testing - link is down (3 hours later) - read error: No route to host first keepalive probe (2 hours later) second keepalive probe (4 hours later)

More Related