CS 356: Computer Network Architectures Lecture 19: Congestion - - PowerPoint PPT Presentation

cs 356 computer network architectures lecture 19
SMART_READER_LITE
LIVE PREVIEW

CS 356: Computer Network Architectures Lecture 19: Congestion - - PowerPoint PPT Presentation

CS 356: Computer Network Architectures Lecture 19: Congestion Avoidance Chap. 6.4 and related papers Xiaowei Yang xwy@cs.duke.edu Overview More on TCP congestion control Theory Macroscopic behavior TCP Cubic Queuing


slide-1
SLIDE 1

CS 356: Computer Network Architectures Lecture 19: Congestion Avoidance

  • Chap. 6.4 and related papers

Xiaowei Yang xwy@cs.duke.edu

slide-2
SLIDE 2

2

Overview

  • More on TCP congestion control

– Theory – Macroscopic behavior – TCP Cubic

  • Queuing mechanisms

– DropTail – Weighted fair queuing – Deficit round robin

  • Congestion Avoidance

– Random Early Detection (RED) – Explicit Congestion Notification

slide-3
SLIDE 3

Administrivia

  • Midterm summary

– Will discussion solutions in next lecture – Return exams

slide-4
SLIDE 4

Two Modes of Congestion Control

  • 1. Probing for the available bandwidth

– slow start (cwnd < ssthresh)

  • 2. Avoid overloading the network

– congestion avoidance (cwnd >= ssthresh)

slide-5
SLIDE 5

Slow Start

  • Initial value:

Set cwnd = 1 MSS

  • Modern TCP implementation may set initial cwnd to 2
  • When receiving an ACK, cwnd+= 1 MSS
  • If an ACK acknowledges two segments, cwnd is still

increased by only 1 segment.

  • Even if ACK acknowledges a segment that is smaller

than MSS bytes long, cwnd is increased by 1.

  • Question: how can you accelerate your TCP download?
slide-6
SLIDE 6

Congestion Avoidance

  • If cwnd >= ssthresh then each time an ACK is

received, increment cwnd as follows:

  • cwnd += MSS * (MSS / cwnd) (cwnd measured in

bytes)

  • So cwnd is increased by one MSS only if all

cwnd/MSS segments have been acknowledged.

slide-7
SLIDE 7

7

The Sawtooth behavior of TCP

  • For every ACK received

– Cwnd += 1/cwnd *MSS

  • For every packet lost

– Cwnd /= 2

RTT Cwnd

slide-8
SLIDE 8

8

Why does it work? [Chiu-Jain]

– A feedback control system – The network uses feedback y to adjust users’ load åx_i

slide-9
SLIDE 9

9

Goals of Congestion Avoidance

– Efficiency: the closeness of the total load on the resource ot its knee – Fairness:

  • When all x_i’s are equal, F(x) = 1
  • When all x_i’s are zero but x_j = 1, F(x) = 1/n

– Distributedness

  • A centralized scheme requires complete knowledge of the state of the

system

– Convergence

  • The system approach the goal state from any starting state
slide-10
SLIDE 10

10

Metrics to measure convergence

  • Responsiveness
  • Smoothness
slide-11
SLIDE 11

11

Model the system as a linear control system

  • Four sample types of controls
  • AIAD, AIMD, MIAD, MIMD
slide-12
SLIDE 12

12

Phase plot

x1 x2

slide-13
SLIDE 13

13

TCP congestion control is AIMD

  • Problems:

– Each source has to probe for its bandwidth – Congestion occurs first before TCP backs off – Unfair: long RTT flows obtain smaller bandwidth shares

RTT Cwnd

slide-14
SLIDE 14

14

Macroscopic behavior of TCP

p RTT MSS

  • 5

. 1

  • Throughput is inversely proportional to RTT:
  • In a steady state, total packets sent in one sawtooth cycle:

– S = w + (w+1) + … (w+w) = 3/2 w2

  • the maximum window size is determined by the loss rate

– 1/S = p – w =

  • The length of one cycle: w * RTT
  • Average throughput: 3/2 w * MSS / RTT

1 1.5p

slide-15
SLIDE 15

TCP Cubic

  • CUBIC: a new TCP-friendly high-speed TCP

variant by S. HaNorth, I. Rhee, and L. Xu

  • Implemented in Linux kernel and Windows 10
slide-16
SLIDE 16

16

Overview

  • More on TCP congestion control

– Theory – Macroscopic behavior – TCP Cubic

  • Queuing mechanisms

– DropTail – Weighted fair queuing – Deficit round robin

  • Congestion Avoidance

– Random Early Detection (RED) – Explicit Congestion Notification

slide-17
SLIDE 17

Design Space for resource allocation

  • Router-based vs. Host-based
  • Reservation-based vs. Feedback-based
  • Window-based vs. Rate-based
slide-18
SLIDE 18

18

Overview

  • More on TCP congestion control

– Theory – Macroscopic behavior – TCP Cubic

  • Queuing mechanisms

– DropTail – Weighted fair queuing – Deficit round robin

  • Congestion Avoidance

– Random Early Detection (RED) – Explicit Congestion Notification

slide-19
SLIDE 19

Queuing mechanisms

  • Router-enforced resource allocation
  • Default

– First come first serve (FIFO)

slide-20
SLIDE 20

Properties of Fair Queuing

  • Work conserving

– Link busy if there is traffic to send

  • Max-min fair

– Cannot increase without decreasing any flow with a no-greater share

slide-21
SLIDE 21

Weighted Fair Queuing

  • Different queues get different weights

– Take wi amount of bits from a queue in each round – Fi = Si + Pi / wi

w=2 w=1

slide-22
SLIDE 22

Deficit Round Robin (DRR)

  • WFQ: extracting min is O(log Q)
  • DRR: O(1) rather than O(log Q)

– Each queue is allowed to send Q bytes per round – If Q bytes are not sent (because packet is too large) deficit counter of queue keeps track of unused portion – If queue is empty, deficit counter is reset to 0 – Similar behavior as FQ but computationally simpler

slide-23
SLIDE 23
  • Unused quantum saved for the next round
  • How to set quantum size?

– Too small – Too large

slide-24
SLIDE 24

Congestion Avoidance

Slow down before packet loss happens

slide-25
SLIDE 25

Design goals

  • Predict when congestion

is going to happen

  • Reduce sending rate

before buffer overflows

  • Not widely deployed

– Reducing queuing delay and packet loss are not essential

slide-26
SLIDE 26

Mechanisms

  • Router+host joint control

– Router: Early signaling of congestion – Host: react to congestion signals – Case studies: DECbit, Random Early Detection

  • Host: Source-based congestion avoidance

– Host detects early congestion – Case study: TCP Vegas

slide-27
SLIDE 27

DECbit

  • Add a congestion bit to a packet header
  • A router sets the bit if its average queue length is non-zero

– Queue length is measured over a busy+idle interval

  • If less than 50% of packets in one window do not have the bit set

– A host increases its congest window by 1 packet

  • Otherwise

– Decreases by 0.875

  • AIMD
slide-28
SLIDE 28

Random Early Detection

  • Random early detection (Floyd93)

– Goal: operate at the “knee” – Problem: very hard to tune (why)

  • RED is generalized by Active Queue Managment (AQM)
  • A router measures average queue length using

exponential weighted averaging algorithm:

– AvgLen = (1-Weight) * AvgLen + Weight * SampleQueueLen

slide-29
SLIDE 29

RED algorithm

  • If AvgLen ≤ MinThreshold

– Enqueue packet

  • If MinThreshold < AvgLen < MaxThreshold

– Calculate dropping probability P – Drop the arriving packet with probability P

  • If MaxThreshold ≤ AvgLen

– Drop the arriving packet

avg_qlen p min_thresh 1 max_thresh

slide-30
SLIDE 30
slide-31
SLIDE 31

Even out packet drops

  • TempP = MaxP x (AvgLen – Min)/(Max-Min)
  • P = TempP / (1 – count * TempP)
  • Count

– keeps track of how many newly arriving packets have been queued when min < Avglen < max

  • It keeps drop evenly distributed over time, even if

packets arrive in burst

avg_qlen TempP min_thresh 1 max_thresh

slide-32
SLIDE 32

An example

  • MaxP = 0.02
  • AvgLen is half way between min and max thresholds
  • TempP = 0.01
  • A burst of 1000 packets arrive
  • With TempP, 10 packets may be discarded uniformly

randomly among the 1000 packets

  • With P, they are likely to be more evently spaced out,

as P gradually increases if previous packets are not discarded

slide-33
SLIDE 33

Explicit Congestion Notification

  • A new IETF standard
  • Two bits in IP header

– 00: No ECN support – 01/10: ECN enabled transport – 11: Congestion experienced

  • Two TCP flags

– ECE: congestion experienced – CWR: cwnd reduced

X CE=1 ECE=1 CWR=1

slide-34
SLIDE 34

Source-based congestion avoidance

  • TCP Vegas

– Detect increases in queuing delay – Reduces sending rate

  • Details

– Record baseRTT (minimum seen) – Compute ExpectedRate = cwnd/BaseRTT – Diff = ExpectedRate - ActualRate – When Diff < α, incr cwnd linearly, when Diff > β, decr cwnd linearly

  • α < β
slide-35
SLIDE 35

cwnd

slide-36
SLIDE 36

Summary

  • The problem of network resource allocation

– Case studies

  • TCP congestion control
  • Fair queuing
  • Congestion avoidance

– Active queue management – Source-based congestion avoidance