200 likes | 297 Views
TCP Behavior and Performance. Workshop on QoS Hanoch Levy April 2003. IP and TCP. IP finds the way to send the packet is sent from end to end. IP is UNRELIABLE (pkts lost delayed) TCP: Transport Control Protocol Above IP Tasks: Guaranteed arrivals Flow control.
E N D
TCP Behavior and Performance Workshop on QoS Hanoch Levy April 2003 Hanoch Levy, CS, TAU
IP and TCP • IP finds the way to send the packet is sent from end to end. • IP is UNRELIABLE (pkts lost delayed) • TCP: Transport Control Protocol • Above IP • Tasks: • Guaranteed arrivals • Flow control Hanoch Levy, CS, TAU
What / Why Flow Control • Control the flow of packets out of source • Purposes: • Don’t flood recipient • Don’t flood the network • Don’t send data no-body can take (“BW waste”). Hanoch Levy, CS, TAU
The General Philosophy • Sender sends packets • Receiver sends ACKS for packets received. • ACKS serve kind of an indication regarding how much can send more. • General notion: Receiver gives sender indication of how much more can be sent. Hanoch Levy, CS, TAU
TCP Sliding Window Offered window Advertised by receiver 1 2 3 4 5 6 7 8 9 10 11 …. Sent & acked Sent not acked Can send ASAP Cant send until W moves Hanoch Levy, CS, TAU
Window properties (fixed size) • Closes when left side moves to right (packets sent by sender) • Opens when right side move to right (acks by received by sender). • Shrinks when right moves to left. RFC strongly opposes this – but must be able to cope with this. Hanoch Levy, CS, TAU
Window size • Not “how open”. Rather – “how large”. • Receiver can determine the size of the window. • Measure can be by bytes/packets. TCP: bytes. Hanoch Levy, CS, TAU
Slow Start • “normal start”: when starting, sender can send as much as the widow size right away. • Slow Start (TCP): • Desire: rate of packets limited by rate of acks • Add a congestion window (cwnd) – to the control. • Sender can send up to the MIN of congestion window and advertised window. Hanoch Levy, CS, TAU
Congestion Window • Starts at 1 (segment) • Every time an ack received: Increase congestions window by 1. • Cwnd=1, pckt 1, • Ack 1 • Cwnd=2, pckt 2, 3 • Ack 2 ,3 • Cwnd = 4, pckt 4, 5, 6, 7 • Ack 4 5 6 7 • “Exponential growth” Hanoch Levy, CS, TAU
How large should the window be • Desire: fill up the pipe: • That is: • Capacity (bits) = bandwidth (bit/sec) x round trip time (sec) • Algorithm aim: reach that neighborhood • (by trial and error). Hanoch Levy, CS, TAU
Time out and Retransmission • A retransmission timer used when expecting an ack from receiver • How large: ‘roughly as round trip time” • Other timers: • Persist timer • Keepalive timer • 2MSL timer Hanoch Levy, CS, TAU
Estimating RTT • Measure for each packet sent / ack received: • Record by the value M. • Compute R via a smoothing factor as follows: • Retransmission timeout (RTO)= • Where is an estimator of delay variance (recommended value =2) Hanoch Levy, CS, TAU
Variance • A more sophisticated algorithm is used • (rather than taking the fixed value) • Dynamically estimate the variance as well. Hanoch Levy, CS, TAU
Congestion avoidance: lost packets. • When sense congestion: reduce window. • Algorithm: • Init: cwnd1 segment, ssthresh65536 bytes. • Send: MIN of cwnd and receiver window • At congestion (timeout on packt, or duplicate ack): • Ssthresh ½ of current window • If duplicate ack: cwnd ssthresh • If timeout: cwnd 1 • At ack reception: increase cwnd Hanoch Levy, CS, TAU
If cwnd < ssthresh: do slow start • Increase cwnd exponentialy • Else : do congestion avoidance • Increase cwnd linearily: at most 1 segment for RTT Hanoch Levy, CS, TAU
How congestion is sensed: Duplicate acks. • At congestion loss or delayed packet. • receiver may receive out of order • TCP rule: • Sensing out of order: When receiver discovers out of order send DUPLICATE ACK • Duplicate ack == signal for sender about congestion. Hanoch Levy, CS, TAU
More sophistication • See Stevens • Papers. Hanoch Levy, CS, TAU
Questions • Is TCP behavior too noisy? • Will it be less noisy – if session interest is “selfish”? Hanoch Levy, CS, TAU
References • W. R. Stevens, “TCP/IP illustrated”, Vol I. • INFOCOM’01: 4 papers on TCP performance modeling • INFOCOM’02: 4 papers • Many others. Hanoch Levy, CS, TAU
References Hanoch Levy, CS, TAU