16
Transport Layer 3-1 TCP seq. numbers, ACKs sequence numbers: byte stream numberof first byte in segments data acknowledgements: seq # of next byte expected from other side cumulative ACK Q: how receiver handles out-of-order segments A: TCP spec doesnt say, - up to implementor source port # dest port # sequence number acknowledgement number checksum rwnd urg pointer incoming segment to sender A sent ACKed sent, not- yet ACKed (in- flight) usable but not yet sent not usable window size N sender sequence number space source port # dest port # sequence number acknowledgement number checksum rwnd urg pointer outgoing segment from sender

TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-1

TCP seq. numbers, ACKs

sequence numbers:

byte stream “number” of first byte in segment’s data

acknowledgements:

seq # of next byte expected from other side

cumulative ACK

Q: how receiver handles out-of-order segments

A: TCP spec doesn’t say, - up to implementor source port # dest port #

sequence number

acknowledgement number

checksum

rwnd

urg pointer

incoming segment to sender

A

sent ACKed

sent, not-yet ACKed(“in-flight”)

usablebut not yet sent

not usable

window sizeN

sender sequence number space

source port # dest port #

sequence number

acknowledgement number

checksum

rwnd

urg pointer

outgoing segment from sender

Page 2: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-2

TCP seq. numbers, ACKs

Usertypes‘C’

host ACKsreceipt

of echoed‘C’

host ACKsreceipt of‘C’, echoesback ‘C’

simple telnet scenario

Host BHost A

Seq=42, ACK=79, data = ‘C’

Seq=79, ACK=43, data = ‘C’

Seq=43, ACK=80

Page 3: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-3

timeout interval: EstimatedRTT plus “safety margin” large variation in EstimatedRTT -> larger safety margin

estimate SampleRTT deviation from EstimatedRTT:

DevRTT = (1-)*DevRTT +

*|SampleRTT-EstimatedRTT|

TCP round trip time, timeout

(typically, = 0.25)

TimeoutInterval = EstimatedRTT + 4*DevRTT

estimated RTT “safety margin”

Retransmissions excluded from TimeoutInterval computation

Page 4: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-4

TCP Congestion Control: details

sender limits transmission:

cwnd is dynamic, function of perceived network congestion

TCP sending rate:

roughly: send cwnd bytes, wait RTT for ACKS, then send more bytes

last byteACKed sent, not-

yet ACKed(“in-flight”)

last byte sent

cwnd

LastByteSent-

LastByteAcked< cwnd

sender sequence number space

rate ~~cwnd

RTTbytes/sec

Page 5: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

5

Additive Increase/Multiplicative

Decrease

Objective: adjust to changes in the available capacity

New state variable per connection: CongestionWindow limits how much data source has in transit

MaxWin = MIN(CongestionWindow, AdvertisedWindow)

EffWin = MaxWin - (LastByteSent - LastByteAcked)

Idea: increase CongestionWindow when congestion goes down

decrease CongestionWindow when congestion goes up

Page 6: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

6

AIMD (cont)

Trace: sawtooth shape behavior

60

20

1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0

KB

Time (seconds)

70

30

40

50

10

10.0

Page 7: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

7

Slow Start Objective: quickly determine the available

capacity in the first

Idea: begin with CongestionWindow = 1 pckt

double CongestionWindow each RTT (increment by 1 packet for each ACK)

This is exponential increase to probe for available bandwidth

Up to half of cwnd may get lost

Used… when first starting connection

when connection goes dead waiting for timeout

SSTHRESH (slow start threshold)indicates when to begin additive increase phase

Source Destination

Page 8: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

8

SSTHRESH and CWND

SSTHRESH typically very large on connection setup

Set to one half of CongestionWindow on packet loss

So, SSTHRESH goes through multiplicative decrease for each packet loss

If loss is indicated by timeout, set CongestionWindow = 1

• SSTHRESH and CongestionWindow always >= 1 MSS

After loss, when new data is ACKed, increase CWND Manner depends on whether we’re in slow start or congestion avoidance

Page 9: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

9

Congestion Control Functionality

Slow Start phase (exponential growth)

Each returning ACK, a new pckt is transmitted• cwnd -> cwnd + 1

Every RTT• cwnd -> 2 cwnd

Congestion avoidance phase (linear growth)

Each returning ACK, a new pckt is transmitted• cwnd -> cwnd + (1/cwnd)

Every RTT• cwnd -> cwnd + 1

When cwnd > slow_start_threshold

Until cwnd ≤ slow_start_threshold

Page 10: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

10

Loss recovery

Two ways to detect losses

Time outs

Three dupacks

With timeout expiration

ssthresh = cwnd / 2

cwnd = 1 (so, restart in slow start phase)

With three dupacks ssthresh = cwnd / 2

cwnd = cwnd / 2 (so, restart in cong. avoidance phase)

Page 11: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

11

TCP Saw Tooth

Time

CongestionWindow

InitialSlowstart

Fast Retransmit

and Recovery

Slowstartto pacepackets

Timeoutmay stilloccur

Timeout

Three dupacks

Page 12: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Mathis et. al, 1997 – Macroscopic TCP

Throughput EstimationW max cwndp periodic loss prob. at end. cycleMSS Maximum segment size

CA: linear increase

Loss

Page 13: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Model Validation

Transport Layer 3-13

Page 14: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-14

Approaches towards congestion control

two broad approaches towards congestion control:

end-end congestion control:

no explicit feedback from network

congestion inferred from end-system observed loss, delay

approach taken by TCP

network-assisted congestion control:

routers provide feedback to end systems

single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM)

explicit rate for sender to send at

Page 15: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-15

Case study: ATM ABR congestion control

ABR: available bit rate: “elastic service”

if sender’s path “underloaded”:

sender should use available bandwidth

if sender’s path congested:

sender throttled to minimum guaranteed rate

RM (resource management) cells:

sent by sender, interspersed with data cells

bits in RM cell set by switches (“network-assisted”)

NI bit: no increase in rate (mild congestion)

CI bit: congestion indication

RM cells returned to sender by receiver, with bits intact

Page 16: TCP seq. numbers, ACKsabujari/fis1920/lec... · If loss is indicated by timeout, set CongestionWindow = 1 • SSTHRESH and CongestionWindowalways >= 1 MSS After loss, when new data

Transport Layer 3-16

Case study: ATM ABR congestion control

two-byte ER (explicit rate) field in RM cell congested switch may lower ER value in cell

senders’ send rate thus max supportable rate on path

EFCI bit in data cells: set to 1 in congested switch

if data cell preceding RM cell has EFCI set, receiver sets CI bit in returned RM cell

RM cell data cell