Embed
Email

Performance

Document Sample

Shared by: yaosaigeng
Categories
Tags
Stats
views:
0
posted:
10/31/2011
language:
English
pages:
23
Transport Layer

TCP and UDP







IS250

Spring 2010



chuang@ischool.berkeley.edu

Transport Layer Functions



1. Addressing (ports)

2. Data integrity (error detection)

3. Reliable data transport

4. Flow control

5. Congestion control







John Chuang 2

TCP Transmission Rate









 Q: Why limit ourselves to send only four packets at a time?

 Q: how much data can be sent before ACK received?

John Chuang 3

Flow Control



Queue

Producer Consumer

Stream

of messages



Flow control

(“Slow down please!”)





Note: We don’t want packet to travel the entire

network only to be dropped at the destination.





John Chuang 4

Flow Control: Two Approaches



 Stop-and-go  Sliding Window









John Chuang 5

Sliding Window

 Recipient explicitly

requests lower send rate

by specifying window size

(or MaxUnackedPackets)

 Source stops sending

when number of

unacknowledged data

equal to window size



window_size







acknowledged sent can be sent outside window

John Chuang 6

TCP Header: Flow Control

0 16 31



Source Port Number (16) Destination Port Number (16)

TCP Header









Sequence Number (32)



Acknowledgement Number (32)

Hdr Len

Reserved (6) Flags (6) Window Size (16)

(4)

TCP Checksum (16) Urgent Pointer (16)



Options (if any) Padding



Data











John Chuang 7

TCP Flow Control









John Chuang 8

Throughput as Function of

Window Size

Sender









Receiver

Time





Window Size

Throughput =

Roundtrip Time

John Chuang 9

Transport Layer Functions



1. Addressing (ports)

2. Data integrity (error detection)

3. Reliable data transport

4. Flow control

5. Congestion control







John Chuang 10

Network Congestion



 If link is congested

- Router queue fills up

- Drops packets

 Source does not receive ACK

- Resends packets

- Makes congestion worse







John Chuang 11

TCP Congestion Control

 Use packet drop as indicator of congestion

 Do not send all data to receiver at once

 Voluntary source-imposed policy (RFC 2581)

- slow start (SS)

- congestion avoidance (CA)

- fast retransmission

- fast recovery

 TCP Tahoe: SS + CA + fast retransmission

 TCP Reno: all four

 Other variants: TCP SACK, TCP Vegas, TCP

Westwood, …



John Chuang 12

TCP Congestion + Flow Control

window_size







acknowledged sent can be sent outside window



 Control transmission rate by setting window size

 Window size set to be smaller of:

- rwnd: receiver window (flow control)

- cwnd: congestion window (congestion control)



win = min(rwnd, cwnd)

 rwnd set by receiver

 Question: how does sender set cwnd?

John Chuang 13

Congestion Window Size

cwnd





Congestion

Avoidance

Slow Start









Time

 TCP congestion control is an algorithm for

sender to adaptively adjust window size

 At steady state, cwnd oscillates around the

optimal window size



14

Slow Start



 Whenever starting traffic on a new connection,

or whenever increasing traffic after congestion

was experienced:



- Set cwnd =1 (one segment)

- Each time a segment is acknowledged increment

cwnd by one (cwnd++).



 Does Slow Start increment slowly? Not really.

In fact, the increase of cwnd is exponential



John Chuang 15

Slow Start Example

cwnd = 1 segment 1

 The congestion ACK for segmen

t1



window size grows cwnd = 2 segment 2



very rapidly segment 3



ts 2 + 3

ACK for segmen

cwnd = 4

 TCP slows down

segment 4

segment 5



the increase of segment 6

segment 7



cwnd when ts 4+5+6+7

ACK for segmen

cwnd >= cwnd = 8

ssthresh







John Chuang 16

Congestion Avoidance



 Slows down “Slow Start”



- If cwnd > ssthresh then

each time a segment is acknowledged increment

cwnd by 1/cwnd (cwnd += 1/cwnd).





 So cwnd is increased by one only if all

segments have been acknowledged.

 (We will learn later how to set ssthresh)

John Chuang 17

Slow Start/Congestion

Avoidance Example

cwnd = 1

 Assume that ssthresh = 8 cwnd = 2





14 cwnd = 4

12

10

Cwnd (in segments)









cwnd = 8

8

ssthresh

6

4

2 cwnd = 9



0

0





2





4





6

t=





t=





t=





t=









Roundtrip times

cwnd = 10

John Chuang 18

TCP Congestion Control Pseudo-

code

Initially: win = min(cwnd, rwnd);

cwnd = 1;

ssthresh = infinite;

while (next < unack + win)

New ack received:

transmit next packet;

if (cwnd < ssthresh)

/* Slow Start*/

cwnd = cwnd + 1;

else SEQ #

/*Congestion Avoidance*/ unack next

cwnd = cwnd + 1/cwnd;

Timeout:

win

/* Multiplicative decrease */

ssthresh = 0.5 * win;

cwnd = 1;

19

The big picture



cwnd









Timeout



Congestion

Avoidance



Slow Start









1

Time









20

Cumulative and Duplicate

ACKs

 TCP uses cwnd = 1 segment 1





cumulative ACK n t1

ACK for segme

ACK 2

cwnd = 2

 ACK N means all

segment 2

segment 3



bytes up to N-1

have been received cwnd = 4

ACK 4 ACK 3

segment 4

segment 5

segment 6

 Duplicate ACKs may segment 7

ACK 4

be due to cwnd = 2 ACK 4 nts 4+5+6+7

ACK for segme

- packets

ACK 4

cwnd = 8



reordering

- lost packet

John Chuang 21

Fast Retransmit/Fast

Recovery

cwnd





Congestion

Avoidance

Slow Start









1

Time

 Retransmit after 3 duplicated ACKs

- Don’t want for timeout

 No need to slow start again

- halve cwnd

 At steady state, cwnd oscillates around the

optimal window size. 22

TCP Congestion Control

Shortcomings



 “Fairness criterion”

- Is “equal division” of resources always desirable?

 Estimating congestion by retransmission is

flawed for wireless links

 Depends on accurate implementation --

cheating possible

 Application can avoid congestion control by

using UDP





John Chuang 23



Related docs
Other docs by yaosaigeng
_49AEFA4B-4737-43A3-9750-5AAF48CC4E0F_
Views: 0  |  Downloads: 0
_micros_ltda_listado_general_de_productos
Views: 0  |  Downloads: 0
Z_Extra_0211
Views: 0  |  Downloads: 0
ZVL Subcontractor Bid List Registration Form
Views: 0  |  Downloads: 0
ZipDomains
Views: 0  |  Downloads: 0
zemin davranisiSİYAH BEYAZ
Views: 0  |  Downloads: 0
zakon_za_zdraveto
Views: 0  |  Downloads: 0
Z1ServiceContract
Views: 0  |  Downloads: 0
YPLAResponsibilities
Views: 0  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!