Download presentation
1
TCP Timeout and Retransmission
Chap 1 Foundation TCP Timeout and Retransmission (월) 이 병 희
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)
Chap 1 Foundation 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 g = gain (g) h = 0.25 the gain for deviation
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
Chap 1 Foundation TCP Persist Timer
11
Chap 1 Foundation 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 start persist timer at segment 3
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
SWS example sun.1069 bsdi.7777 PSH 1:1025(1024) ack 1, win 4096
3 4 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 0.0 (0.0020) (0.0017) (0.0016) (0.1649) (4.9815) (0.0185) (4.9813) (0.0187) (4.9812) (0.0188)
15
SWS example 12 13 14 15 16 17 18 19 20 21 4100:5124(1024) ack 1, win 4096 ack 5124, win 509 5124:5633(509) ack 1, win 4096 ack 5633, win 0 5633:5634(1) ack 1, win 4096 ack 5634, win 1279 FIN, PSH 5634:6145(511) ack 1, win 4096 ack 6146, win 767 ack 6146, win 2816 FIN 1:1(0) ack 6146, win 4096 ack 2, win 4096 22 sun.1069 bsdi.7777 (0.0017) (0.1983) (4.7815) (0.0185) (4.9809) (0.0191) (0.0015) (0.0026) ( ) ( ) (0.0009)
16
SWS example
17
SWS example
18
Chap 1 Foundation 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
State of Client’s host and Server
Description States of client and server If there is no activity for two hours, the server sends a probe segment to the client State of Client’s host and Server Server’s Action The client’s host is running and reachable from the server Server’s TCP will reset keepalive timer for 2 hours. If data across the TCP connection before expire, timer is reset for 2 hours again. The client’s host has crashed and is either down or in the process of rebooting Server will not receive response in 75 second. Server sends total 10 probes, 75 second apart. If no response, server will terminate the connection The client’s host has just rebooted Because client has just rebooted, server will receive response but it will be a reset. So, server terminates the connection The client’s host is running, but unreachable from the server Same as client’s down. Server terminates the connection after 10 probes, 75 second apart.
21
- disconnect cable –(4 hours later) second keepalive probe
Keepalive Example Other End Crashes bsdi % sock –K svr4 echo 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
read error: Connection reset by peer
Keepalive Example Other End Crashes and Reboot bsdi % sock –K svr4 echo hi there read error: Connection reset by peer first keepalive probe (2 hours later)
23
- link is down (3 hours later) - second keepalive probe
Keepalive Example Other End is Unreachable slip % sock –K vangogh.cs.berkeley.edu echo 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) Client Server Terminate the connection Router (alive) (down)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.