CS 356: Introduction to Computer Networks Lecture 16: Transmission Control Protocol (TCP)
- Chap. 5.2, 6.3
CS 356: Introduction to Computer Networks Lecture 16: Transmission - - PowerPoint PPT Presentation
CS 356: Introduction to Computer Networks Lecture 16: Transmission Control Protocol (TCP) Chap. 5.2, 6.3 Xiaowei Yang xwy@cs.duke.edu Overview TCP Connection management Flow control When to transmit a segment Adaptive
TCP
IP Internetwork
Byte Stream Byte Stream
TCP
Source: http://www.webperformancetoday.com/2011/11/23/case-study- slow-page-load-mobile-business-metrics/
Source: http://www.webperformancetoday.com/2012/02/28/4-awesome-slides- showing-how-page-speed-correlates-to-business-metrics-at-walmart-com/
Sender Window Size Receiver Window Size
IP header TCP header TCP data Sequence number (32 bits) DATA
20 bytes 20 bytes 15 16 31 Source Port Number Destination Port Number
Acknowledgement number (32 bits) window size
header length
Flags Options (if any) TCP checksum urgent pointer
20 bytes
When app has data to send if data and window >= MSS send a full segment else if there is unACKed data buffer new data until ACK else send all the new data now
Segment 1 S e g m e n t 4 A C K f
S e g m e n t 1 Segment 2 Segment 3 ACK for Segment 2 + 3 S e g m e n t 5 ACK for Segment 4 ACK for Segment 5 RTT #1 RTT #2 RTT #3
segment ACK retransmission
Timeout !
RTT ? RTT ?
End of Options
kind=0
1 byte NOP (no operation)
kind=1
1 byte Maximum Segment Size
kind=2
1 byte
len=4
1 byte
maximum segment size
2 bytes Window Scale Factor
kind=3
1 byte
len=3
1 byte
shift count
1 byte Timestamp
kind=8
1 byte
len=10
1 byte
timestamp value
4 bytes
timestamp echo reply
4 bytes
IP header TCP header TCP data Sequence number (32 bits) DATA
20 bytes 20 bytes 15 16 31 Source Port Number Destination Port Number
Acknowledgement number (32 bits) window size
header length
Flags Options (if any) TCP checksum urgent pointer
20 bytes
Time until 32-bit sequence number space wraps around.
Kind = 3 Length = 3 Shift.cnt Three bytes
system operate around the knee to
throughput
system operate left to the cliff to avoid congestion collapse
cwnd = 1 cwnd = 2 cwnd = 4 cwnd = 8 cwnd = 9 cwnd = 10
2 4 6 8 10 12 14 t=0 t=2 t=4 t=6
Roundtrip times Cwnd (in segments) ssthresh
54
1 K S e q N
A c k N
1 2 4 A c k N
1 2 4 1 K S e q N
1 2 4 S e q N
2 4 8 1 K A c k N
1 2 4 S e q N
3 7 2 1 K S e q N
4 9 6 1 K
A c k N
1 2 4 S e q N
1 2 4 1 K S e q N
5 1 2 1 K
CA SS
Fast retransmission/fast recovery TCP saw tooth
– Efficiency: the closeness of the total load on the resource ot its knee – Fairness:
– Distributedness
system
– Convergence
x1 x2