Chapter 12 TCP Traffic Control 1 Introduction TCP

  • Slides: 58
Download presentation
Chapter 12 TCP Traffic Control 1

Chapter 12 TCP Traffic Control 1

Introduction TCP Flow Control l TCP Congestion Control l Performance of TCP over ATM

Introduction TCP Flow Control l TCP Congestion Control l Performance of TCP over ATM l Chapter 12 TCP Traffic Control 2

TCP Flow Control Uses a form of sliding window l Differs from mechanism used

TCP Flow Control Uses a form of sliding window l Differs from mechanism used in LLC, HDLC, X. 25, and others: l l l Decouples acknowledgement of received data units from granting permission to send more TCP’s flow control is known as a credit allocation scheme: l Each transmitted octet is considered to have a sequence number Chapter 12 TCP Traffic Control 3

TCP Header Fields for Flow Control Sequence number (SN) of first octet in data

TCP Header Fields for Flow Control Sequence number (SN) of first octet in data segment l Acknowledgement number (AN) l Window (W) l Acknowledgement contains AN = i, W = j: l Octets through SN = i - 1 acknowledged l Permission is granted to send W = j more octets, i. e. , octets i through i + j - 1 l Chapter 12 TCP Traffic Control 4

Figure 12. 1 TCP Credit Allocation Mechanism Chapter 12 TCP Traffic Control 5

Figure 12. 1 TCP Credit Allocation Mechanism Chapter 12 TCP Traffic Control 5

Credit Allocation is Flexible Suppose last message B issued was AN = i, W

Credit Allocation is Flexible Suppose last message B issued was AN = i, W = j To increase credit to k (k > j) when no new data, B issues AN = i, W = k l To acknowledge segment containing m octets (m < j), B issues AN = i + m, W = j - m l Chapter 12 TCP Traffic Control 6

Figure 12. 2 Flow Control Perspectives Chapter 12 TCP Traffic Control 7

Figure 12. 2 Flow Control Perspectives Chapter 12 TCP Traffic Control 7

Credit Policy Receiver needs a policy for how much credit to give sender l

Credit Policy Receiver needs a policy for how much credit to give sender l Conservative approach: grant credit up to limit of available buffer space l May limit throughput in long-delay situations l Optimistic approach: grant credit based on expectation of freeing space before data arrives l Chapter 12 TCP Traffic Control 8

Effect of Window Size W = TCP window size (octets) R = Data rate

Effect of Window Size W = TCP window size (octets) R = Data rate (bps) at TCP source D = Propagation delay (seconds) l After TCP source begins transmitting, it takes D seconds for first octet to arrive, and D seconds for acknowledgement to return l TCP source could transmit at most 2 RD bits, or RD/4 octets Chapter 12 TCP Traffic Control 9

Normalized Throughput S 1 W > RD / 4 4 W RD W <

Normalized Throughput S 1 W > RD / 4 4 W RD W < RD / 4 S = Chapter 12 TCP Traffic Control 10

Figure 12. 3 Window Scale Parameter Chapter 12 TCP Traffic Control 11

Figure 12. 3 Window Scale Parameter Chapter 12 TCP Traffic Control 11

Complicating Factors l l Multiple TCP connections are multiplexed over same network interface, reducing

Complicating Factors l l Multiple TCP connections are multiplexed over same network interface, reducing R and efficiency For multi-hop connections, D is the sum of delays across each network plus delays at each router If source data rate R exceeds data rate on one of the hops, that hop will be a bottleneck Lost segments are retransmitted, reducing throughput. Impact depends on retransmission policy Chapter 12 TCP Traffic Control 12

Retransmission Strategy l l l TCP relies exclusively on positive acknowledgements and retransmission on

Retransmission Strategy l l l TCP relies exclusively on positive acknowledgements and retransmission on acknowledgement timeout There is no explicit negative acknowledgement Retransmission required when: 1. 2. Segment arrives damaged, as indicated by checksum error, causing receiver to discard segment Segment fails to arrive Chapter 12 TCP Traffic Control 13

Timers l l l A timer is associated with each segment as it is

Timers l l l A timer is associated with each segment as it is sent If timer expires before segment acknowledged, sender must retransmit Key Design Issue: value of retransmission timer l l Too small: many unnecessary retransmissions, wasting network bandwidth Too large: delay in handling lost segment Chapter 12 TCP Traffic Control 14

Two Strategies l l Timer should be longer than round-trip delay (send segment, receive

Two Strategies l l Timer should be longer than round-trip delay (send segment, receive ack) Delay is variable Strategies: 1. Fixed timer 2. Adaptive Chapter 12 TCP Traffic Control 15

Problems with Adaptive Scheme Peer TCP entity may accumulate acknowledgements and not acknowledge immediately

Problems with Adaptive Scheme Peer TCP entity may accumulate acknowledgements and not acknowledge immediately l For retransmitted segments, can’t tell whether acknowledgement is response to original transmission or retransmission l Network conditions may change suddenly l Chapter 12 TCP Traffic Control 16

Adaptive Retransmission Timer l Average Round-Trip Time (ARTT) K+1 ARTT(K + 1) = 1

Adaptive Retransmission Timer l Average Round-Trip Time (ARTT) K+1 ARTT(K + 1) = 1 K+1 = Chapter 12 TCP Traffic Control ∑ RTT(i) i=1 K ART(K) + 1 RTT(K + 1) K+1 17

RFC 793 Exponential Averaging Smoothed Round-Trip Time (SRTT) SRTT(K + 1) = α ×

RFC 793 Exponential Averaging Smoothed Round-Trip Time (SRTT) SRTT(K + 1) = α × SRTT(K) + (1 – α) × SRTT(K + 1) The older the observation, the less it is counted in the average. Chapter 12 TCP Traffic Control 18

Figure 12. 4 Exponential Smoothing Coefficients Chapter 12 TCP Traffic Control 19

Figure 12. 4 Exponential Smoothing Coefficients Chapter 12 TCP Traffic Control 19

Figure 12. 5 Exponential Averaging Chapter 12 TCP Traffic Control 20

Figure 12. 5 Exponential Averaging Chapter 12 TCP Traffic Control 20

RFC 793 Retransmission Timeout RTO(K + 1) = Min(UB, Max(LB, β × SRTT(K +

RFC 793 Retransmission Timeout RTO(K + 1) = Min(UB, Max(LB, β × SRTT(K + 1))) UB, LB: prechosen fixed upper and lower bounds Example values for α, β: 0. 8 < α < 0. 9 Chapter 12 TCP Traffic Control 1. 3 < β < 2. 0 21

Implementation Policy Options l l l Send Deliver Accept l l l Retransmit l

Implementation Policy Options l l l Send Deliver Accept l l l Retransmit l l In-order In-window First-only Batch individual Acknowledge l l immediate cumulative Chapter 12 TCP Traffic Control 22

TCP Congestion Control l l Dynamic routing can alleviate congestion by spreading load more

TCP Congestion Control l l Dynamic routing can alleviate congestion by spreading load more evenly But only effective for unbalanced loads and brief surges in traffic Congestion can only be controlled by limiting total amount of data entering network ICMP source Quench message is crude and not effective RSVP may help but not widely implemented Chapter 12 TCP Traffic Control 23

TCP Congestion Control is Difficult l l l IP is connectionless and stateless, with

TCP Congestion Control is Difficult l l l IP is connectionless and stateless, with no provision for detecting or controlling congestion TCP only provides end-to-end flow control No cooperative, distributed algorithm to bind together various TCP entities Chapter 12 TCP Traffic Control 24

TCP Flow and Congestion Control l l The rate at which a TCP entity

TCP Flow and Congestion Control l l The rate at which a TCP entity can transmit is determined by rate of incoming ACKs to previous segments with new credit Rate of Ack arrival determined by round-trip path between source and destination Bottleneck may be destination or internet Sender cannot tell which Only the internet bottleneck can be due to congestion Chapter 12 TCP Traffic Control 25

Figure 12. 6 TCP Segment Pacing Chapter 12 TCP Traffic Control 26

Figure 12. 6 TCP Segment Pacing Chapter 12 TCP Traffic Control 26

Figure 12. 7 TCP Flow and Congestion Control Chapter 12 TCP Traffic Control 27

Figure 12. 7 TCP Flow and Congestion Control Chapter 12 TCP Traffic Control 27

Retransmission Timer Management Three Techniques to calculate retransmission timer (RTO): 1. RTT Variance Estimation

Retransmission Timer Management Three Techniques to calculate retransmission timer (RTO): 1. RTT Variance Estimation 2. Exponential RTO Backoff 3. Karn’s Algorithm Chapter 12 TCP Traffic Control 28

RTT Variance Estimation (Jacobson’s Algorithm) 3 sources of high variance in RTT l If

RTT Variance Estimation (Jacobson’s Algorithm) 3 sources of high variance in RTT l If data rate relative low, then transmission delay will be relatively large, with larger variance due to variance in packet size l Load may change abruptly due to other sources l Peer may not acknowledge segments immediately Chapter 12 TCP Traffic Control 29

Jacobson’s Algorithm SRTT(K + 1) = (1 – g) × SRTT(K) + g ×

Jacobson’s Algorithm SRTT(K + 1) = (1 – g) × SRTT(K) + g × RTT(K + 1) SERR(K + 1) = RTT(K + 1) – SRTT(K) SDEV(K + 1) = (1 – h) × SDEV(K) + h ×|SERR(K + 1)| RTO(K + 1) = SRTT(K + 1) + f × SDEV(K + 1) g = 0. 125 h = 0. 25 f = 2 or f = 4 (most current implementations use f = 4) Chapter 12 TCP Traffic Control 30

Figure 12. 8 Jacobson’s RTO Calculations Chapter 12 TCP Traffic Control 31

Figure 12. 8 Jacobson’s RTO Calculations Chapter 12 TCP Traffic Control 31

Two Other Factors Jacobson’s algorithm can significantly improve TCP performance, but: l What RTO

Two Other Factors Jacobson’s algorithm can significantly improve TCP performance, but: l What RTO to use for retransmitted segments? ANSWER: exponential RTO backoff algorithm l Which round-trip samples to use as input to Jacobson’s algorithm? ANSWER: Karn’s algorithm Chapter 12 TCP Traffic Control 32

Exponential RTO Backoff Increase RTO each time the same segment retransmitted – backoff process

Exponential RTO Backoff Increase RTO each time the same segment retransmitted – backoff process l Multiply RTO by constant: l RTO = q × RTO l q = 2 is called binary exponential backoff Chapter 12 TCP Traffic Control 33

Which Round-trip Samples? l If an ack is received for retransmitted segment, there are

Which Round-trip Samples? l If an ack is received for retransmitted segment, there are 2 possibilities: 1. 2. l l Ack is for first transmission Ack is for second transmission TCP source cannot distinguish 2 cases No valid way to calculate RTT: – From first transmission to ack, or – From second transmission to ack? Chapter 12 TCP Traffic Control 34

Karn’s Algorithm Do not use measured RTT to update SRTT and SDEV l Calculate

Karn’s Algorithm Do not use measured RTT to update SRTT and SDEV l Calculate backoff RTO when a retransmission occurs l Use backoff RTO for segments until an ack arrives for a segment that has not been retransmitted l Then use Jacobson’s algorithm to calculate RTO l Chapter 12 TCP Traffic Control 35

Window Management Slow start l Dynamic window sizing on congestion l Fast retransmit l

Window Management Slow start l Dynamic window sizing on congestion l Fast retransmit l Fast recovery l Limited transmit l Chapter 12 TCP Traffic Control 36

Slow Start awnd = MIN[ credit, cwnd] where awnd = allowed window in segments

Slow Start awnd = MIN[ credit, cwnd] where awnd = allowed window in segments cwnd = congestion window in segments credit = amount of unused credit granted in most recent ack cwnd = 1 for a new connection and increased by 1 for each ack received, up to a maximum Chapter 12 TCP Traffic Control 37

Figure 23. 9 Effect of Slow Start Chapter 12 TCP Traffic Control 38

Figure 23. 9 Effect of Slow Start Chapter 12 TCP Traffic Control 38

Dynamic Window Sizing on Congestion A lost segment indicates congestion l Prudent to reset

Dynamic Window Sizing on Congestion A lost segment indicates congestion l Prudent to reset cwsd = 1 and begin slow start process l May not be conservative enough: “ easy to drive a network into saturation but hard for the net to recover” (Jacobson) l Instead, use slow start with linear growth in cwnd l Chapter 12 TCP Traffic Control 39

Figure 12. 10 Slow Start and Congestion Avoidance Chapter 12 TCP Traffic Control 40

Figure 12. 10 Slow Start and Congestion Avoidance Chapter 12 TCP Traffic Control 40

Figure 12. 11 Illustration of Slow Start and Congestion Avoidance Chapter 12 TCP Traffic

Figure 12. 11 Illustration of Slow Start and Congestion Avoidance Chapter 12 TCP Traffic Control 41

Fast Retransmit l l RTO is generally noticeably longer than actual RTT If a

Fast Retransmit l l RTO is generally noticeably longer than actual RTT If a segment is lost, TCP may be slow to retransmit TCP rule: if a segment is received out of order, an ack must be issued immediately for the last inorder segment Fast Retransmit rule: if 4 acks received for same segment, highly likely it was lost, so retransmit immediately, rather than waiting for timeout Chapter 12 TCP Traffic Control 42

Figure 12. 12 Fast Retransmit Chapter 12 TCP Traffic Control 43

Figure 12. 12 Fast Retransmit Chapter 12 TCP Traffic Control 43

Fast Recovery l l l When TCP retransmits a segment using Fast Retransmit, a

Fast Recovery l l l When TCP retransmits a segment using Fast Retransmit, a segment was assumed lost Congestion avoidance measures are appropriate at this point E. g. , slow-start/congestion avoidance procedure This may be unnecessarily conservative since multiple acks indicate segments are getting through Fast Recovery: retransmit lost segment, cut cwnd in half, proceed with linear increase of cwnd This avoids initial exponential slow-start Chapter 12 TCP Traffic Control 44

Figure 12. 13 Fast Recovery Example Chapter 12 TCP Traffic Control 45

Figure 12. 13 Fast Recovery Example Chapter 12 TCP Traffic Control 45

Limited Transmit l If congestion window at sender is small, fast retransmit may not

Limited Transmit l If congestion window at sender is small, fast retransmit may not get triggered, e. g. , cwnd = 3 1. Under what circumstances does sender have small congestion window? 2. Is the problem common? 3. If the problem is common, why not reduce number of duplicate acks needed to trigger retransmit? Chapter 12 TCP Traffic Control 46

Limited Transmit Algorithm Sender can transmit new segment when 3 conditions are met: 1.

Limited Transmit Algorithm Sender can transmit new segment when 3 conditions are met: 1. Two consecutive duplicate acks are received 2. Destination advertised window allows transmission of segment 3. Amount of outstanding data after sending is less than or equal to cwnd + 2 Chapter 12 TCP Traffic Control 47

Performance of TCP over ATM How best to manage TCP’s segment size, window management

Performance of TCP over ATM How best to manage TCP’s segment size, window management and congestion control… l …at the same time as ATM’s quality of service and traffic control policies l TCP may operate end-to-end over one ATM network, or there may be multiple ATM LANs or WANs with non-ATM networks l Chapter 12 TCP Traffic Control 48

Figure 12. 14 TCP/IP over AAL 5/ATM Chapter 12 TCP Traffic Control 49

Figure 12. 14 TCP/IP over AAL 5/ATM Chapter 12 TCP Traffic Control 49

Performance of TCP over UBR Buffer capacity at ATM switches is a critical parameter

Performance of TCP over UBR Buffer capacity at ATM switches is a critical parameter in assessing TCP throughput performance l Insufficient buffer capacity results in lost TCP segments and retransmissions l Chapter 12 TCP Traffic Control 50

Effect of Switch Buffer Size l l l l Data rate of 141 Mbps

Effect of Switch Buffer Size l l l l Data rate of 141 Mbps End-to-end propagation delay of 6 μs IP packet sizes of 512 octets to 9180 TCP window sizes from 8 Kbytes to 64 Kbytes ATM switch buffer size per port from 256 cells to 8000 One-to-one mapping of TCP connections to ATM virtual circuits TCP sources have infinite supply of data ready Chapter 12 TCP Traffic Control 51

Figure 12. 15 Performance of TCP over UBR Chapter 12 TCP Traffic Control 52

Figure 12. 15 Performance of TCP over UBR Chapter 12 TCP Traffic Control 52

Observations If a single cell is dropped, other cells in the same IP datagram

Observations If a single cell is dropped, other cells in the same IP datagram are unusable, yet ATM network forwards these useless cells to destination l Smaller buffer increase probability of dropped cells l Larger segment size increases number of useless cells transmitted if a single cell dropped l Chapter 12 TCP Traffic Control 53

Partial Packet and Early Packet Discard Reduce the transmission of useless cells l Work

Partial Packet and Early Packet Discard Reduce the transmission of useless cells l Work on a per-virtual circuit basis l Partial Packet Discard l – If a cell is dropped, then drop all subsequent cells in that segment (i. e. , look for cell with SDU type bit set to one) l Early Packet Discard – When a switch buffer reaches a threshold level, preemptively discard all cells in a segment Chapter 12 TCP Traffic Control 54

Selective Drop Ideally, N/V cells buffered for each of the V virtual circuits l

Selective Drop Ideally, N/V cells buffered for each of the V virtual circuits l W(i) = N(i) × V N/V N l If N > R and W(i) > Z then drop next new packet on VC i l Z is a parameter to be chosen l Chapter 12 TCP Traffic Control 55

Figure 12. 16 ATM Switch Buffer Layout Chapter 12 TCP Traffic Control 56

Figure 12. 16 ATM Switch Buffer Layout Chapter 12 TCP Traffic Control 56

Fair Buffer Allocation More aggressive dropping of packets as congestion increases l Drop new

Fair Buffer Allocation More aggressive dropping of packets as congestion increases l Drop new packet when: l N > R and W(i) > Z × B – R N-R Chapter 12 TCP Traffic Control 57

TCP over ABR l l Good performance of TCP over UBR can be achieved

TCP over ABR l l Good performance of TCP over UBR can be achieved with minor adjustments to switch mechanisms This reduces the incentive to use the more complex and more expensive ABR service Performance and fairness of ABR quite sensitive to some ABR parameter settings Overall, ABR does not provide significant performance over simpler and less expensive UBR-EPD or UBR-EPD-FBA Chapter 12 TCP Traffic Control 58