Professional Documents
Culture Documents
1
TCP flow control
application
application may process
remove data from application
TCP socket buffers ….
TCP socket OS
receiver buffers
… slower than TCP
receiver is delivering
(sender is sending) TCP
code
IP
flow control code
receiver controls sender, so
sender won’t overflow receiver’s
buffer by transmitting too much, from sender
too fast
receiver protocol stack
Congestion control
Keep a set of senders from overloading the network
• E.g., persuade hosts to stop sending, or slow down
• Typically has notions of fairness (i.e., sharing the pain)
Packet delay
Packet experiences high delay
5
Idea of TCP Congestion Control
Each source determines the available capacity
… so it knows how many packets to have in transit
Congestion window
Maximum # of unacknowledged bytes to have in transit
MaxWindow = min{congestion window, receiver window}
Send at the rate of the slowest component
6
Additive Increase, Multiplicative Decrease
How much to increase and decrease?
Increase linearly, decrease multiplicatively
Consequences of over-sized window are much worse than having
an under-sized window
• Over-sized window: packets dropped and retransmitted
• Under-sized window: somewhat lower throughput
Multiplicative decrease
On loss of packet, divide congestion window in half
Additive increase
On success for last window of data, increase linearly
7
Leads to the TCP “Sawtooth”
Window
Loss
halved
8
Practical Details
Congestion window
Represented in bytes, not in packets
Packets have MSS (Maximum Segment Size) bytes
9
Getting Started
Need to start with a small CWND to avoid overloading the network.
Window
1 2 4 8
Src
D D D A A D D D D
A
A A A A
Dest
12
Slow Start and the TCP Sawtooth
Window
Loss
Exponential “slow t
start”
13
Two Kinds of Loss in TCP
Triple duplicate ACK
Packet n is lost, but packets n+1, n+2, etc. arrive
Receiver sends duplicate acknowledgments
… and the sender retransmits packet n quickly
Do a multiplicative decrease and keep going
Timeout
Packet n is lost and detected via a timeout
• E.g., because all packets in flight were lost
start over with a low CWND
14
Repeating Slow Start After Timeout
Window
timeout
application application
network network
LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime
CLOSED