1 what is tcp? connection-oriented reliable transfer no packet loss. how? uses acknowledgments,...

13
1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to generate a stream of bytes; then divide stream into small segments; and then sends each segment in IP datagram. Flow control Receiver advertises window that specifies how many additional bytes it can accept.

Upload: lora-curtis

Post on 17-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

1

What is TCP?• Connection-oriented reliable transfer

• No packet loss. How?• Uses acknowledgments, retransmission, and TO.

• Stream paradigm• Allows sender to generate a stream of bytes; then

divide stream into small segments; and then sends each segment in IP datagram.

• Flow control• Receiver advertises window that specifies how

many additional bytes it can accept.

Page 2: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

2

What is TCP?• TCP connection establishment

Send SYN seq=x

Receive SYN seq=xSend SYN seq=y, Ack x+1

Receive SYN, AckSend Ack y+1

Receive Ack

UDP TCP

Datagrams, unreliable

Connectionless (identified by port)

No flow control

No congestion control

Multimedia applications

Segments, reliable

Connection-oriented (socket API binding)

Flow control

Congestion control

All the others

• TCP versus UDP

Page 3: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

3

TCP Congestion Control• Question: How does TCP control network

congestion?

• Specifically, when does TCP increase or decrease its sending rate and how much?

• Here, we will study how TCP supports network congestion control.

Page 4: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

4

Early TCP• Early TCP runs like go-back-n.

sender receiver

1. Send up to a window of data

2. Ack for each packet

3. If TO, resend from the oldest unacked

• What if …

sender router

1. Packet arrives faster than output link

2. Queue grows and packet drops

3. TO and resend … increase network traffic!

Throughput becomes so low Congestion collapse!

Page 5: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

5

Avoid Congestion Collapse?• How can we address the congestion collapse problem?• Can we adopt self-clocking mechanism in TCP?

• Self-clocking• A new packet is not put into network until the old packet leaves.• It is called connection in equilibrium.

Page 6: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

6

Initial Start• Goal: Reach equilibrium by opening up the window

quickly.

1R 2

3

2R 4

65

7

3R 8

129

13

10

1411

15

0R 1

1 RTT

• Sender sets cwnd to 1.• As Ack arrives, cwnd is increased by one segment.• Slow start: exponential increase of cwnd.

Page 7: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

7

Congestion Avoidance• After slow start, what happens?

Congestion Avoidance

Slow Start

ssthresh

• We want to ensure that cwnd does not increase exponentially forever.

• In congestion avoidance, cwnd is increased by 1/cwnd segments (approx. 1 segment per RTT) for one Ack received (additive increase).

TCP cwnd

Page 8: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

8

Congestion Avoidance• What if TO occurs?• It indicates network congestion.

• Update• ssthresh = max(2, min(cwnd/2, rwnd)) segments• This is multiplicative decrease!• cwnd = 1• System goes back to slow start.

• That’s why CA is called AIMD (Additive Increase Multiplicative Decrease).

• AIMD in CA is known to be stable, i.e., converges to a fair share condition.

Page 9: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

9

Can We Do Better?• Usually TO takes long and degrades TCP

performance.• Is there a way to learn network congestion earlier

than TO?

sender receiver

1. Send segments 0 to 5

2. dupAcks(2)

3. Fast retransmit after 3 dupAcks and go back to SS

Segment 2 gets lost

TCP Tahoe (SS, CA, FR)

Page 10: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

10

Even Better?• In TCP Tahoe, should we go back to SS after fast

retransmit? Why?• In addition to packet loss, doesn’t dupAck also

indicate that a segment has left the network ?

sender receiver3 dupAcks

Retransmits lost segmentReduces ssthresh by halfReduces cwnd by halfInflates cwnd by one segment for each dupAck (self-clocking)Comes out of this Fast Recovery when it receives ack for lost segment.

TCP Reno (SS, CA, Fast Recovery)

• Reno tries to keep track of the number of dupAcks to estimate the amount of outstanding data in the net.

• What if there are multiple segment losses?

Page 11: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

11

TCP Congestion Control

Slow-Start

Congestion Avoidance

Additive IncreaseMultiplicative Decrease (AIMD)

Timeout

new ssthresh = cwnd / 2

cwnd

time

ssthresh

1 TCP-Reno3 DupAck

Page 12: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

12

Vegas Dream?• So far, all the schemes use Acks to infer packet losses

to detect network congestion and devise self-clocking.

• Can we estimate expected throughput of a connection and use it for cwnd increase or decrease?

• Congestion avoidance• Expected throughput = current cwnd / min RTT• Actual throughput = bytes xmitted / measured RTT• Diff = expected throughput - actual throughput• If Diff < alpha, linear increase of cwnd (good condition)• Else if Diff > beta, linear decrease of cwnd (congestion)

Page 13: 1 What is TCP? Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to

13

TCP Vegas• Slow start

• Exponential increase cwnd every other RTT.• Calculate Diff using the other RTT.• Transition from SS to CA occurs when actual throughput is

lower than expected throughput by gamma.

• Retransmission• A segment is retransmitted after one dupAck.• This will be helpful when cwnd small or multiple segment

losses.

• TCP Vegas was popular due to its more accurate estimation.

• It was, however, never widely deployed. Why?