Professional Documents
Culture Documents
Computer Networks Chapter 8: Transport Layer: Goal of This Chapter
Computer Networks Chapter 8: Transport Layer: Goal of This Chapter
Computer Networks Chapter 8: Transport Layer: Goal of This Chapter
We will discuss the mechanisms in addition to congestion control that are required to build a reliable, connectionoriented, end-to-end transport protocol
With TCP as the evident case study, intermixed with the presentation We will draw heavily on the material from the link layer, as many similar problems are solved there in similar fashion e.g., sliding window for error control
Holger Karl
WS 09/10, v 1.2
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
Be a good citizen in the network perform congestion control Allow several transport endpoints in a single host
Demultiplexing
WS 09/10, v 1.2
WS 09/10, v 1.2
Addressing
Provide multiple service access points to multiplex several applications
SAPs can identify connections or data flows
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
WS 09/10, v 1.2
WS 09/10, v 1.2
Connection establishment
How to establish a joint context, a connection, between sender and receiver?
Note: only relevant in end-system, network layer assumed to be connection-less
Nave solution:
Sender sends a CONNECTION REQUEST Receiver answers by a CONNECTION ACCEPTED Sender proceeds once that message is received
OK
N CON ED PT E C AC DAT A
OK
OK
8
Solution: Have the sender answer a question that the receiver asks!
Actually: Put sequence numbers into
connection request connection acknowledgement, and connection confirmation
Have to be copied by the receiving party to the other side Connection only established if the correct number is provided
WS 09/10, v 1.2
WS 09/10, v 1.2
10
WS 09/10, v 1.2
11
WS 09/10, v 1.2
12
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
A TCP connection is thus identified by a four tuple: (Source Port, Source IP Address, Destination Port, Destination IP Address)
WS 09/10, v 1.2
13
WS 09/10, v 1.2
14
Connection release
Once connection context between two peers is established, releasing a connection should be easy
Goal: Only release connection when both peers have agreed that they have received all data and have nothing more to say I.e., both sides must have invoked a Close-like service primitive
It fact, it is impossible
Problem: How to be sure that the other peer knows that you know that it knows that you know that all data have been transmitted and that the connection can now safely be terminated?
Which rules shall the commanders use to agree on an attack date? Provably unsolvable if the network can loose messages
How to coordinate?
WS 09/10, v 1.2
15
WS 09/10, v 1.2
16
WS 09/10, v 1.2
17
WS 09/10, v 1.2
18
SYN_SENT
No errors No unusual behavior (closing a socket before establishing connection, ) ! Note: Have a look at the netstat tool (Linux, Cygwin)
WS 09/10, v 1.2 Computer Networks - Ch. 8 - Transport layer 20
FIN/ACK
19
Network
Network
LISTEN
SYN SYN
SYN
FIN_WAIT_1
SYN_SENT
+AC K SYN + ACK ACK
ACK
CLOSE_WAIT
ACK
SYN_RCVD
ACK
ESTABLISHED
WS 09/10, v 1.2 Computer Networks - Ch. 8 - Transport layer 21 WS 09/10, v 1.2 Computer Networks - Ch. 8 - Transport layer 22
Overview
TCP @ Web browser Web browser appl.
Network
FIN_WAIT_2
LAST_ACK
FIN ACK
ACK
TIME_WAIT Timeout
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
CLOSED CLOSED
WS 09/10, v 1.2
23
WS 09/10, v 1.2
24
Flow control
Recall: Flow control = prevent a fast sender from overrunning a slow receiver
Similar issue in link and transport layer
WS 09/10, v 1.2
25
WS 09/10, v 1.2
26
Sender
Sending application
Receiving application
Receiver
Recall: Advertised window limits the amount of data that a sender will inject into the network
TCP sender ensures that LastByteSent LastByteAcked AdvertisedWindow Equivalently: EffectiveWindow = AdvertisedWindow (LastByteSent LastByteAcked)
LastByteWritten
TCP
LastByteRead
TCP
LastByteAcked
LastByteSent
NextByteExpected
LastByteRcvd
WS 09/10, v 1.2
29
WS 09/10, v 1.2
30
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
WS 09/10, v 1.2
32
Interesting case: What if round trip delay D is a random variable? Select timeout such that
It is small enough not to wait too long in case of packet error It is big enough not to prematurely send out a retransmission Full analysis is complicated
Need to take into account both packet error rate and distribution of D
WS 09/10, v 1.2
33
WS 09/10, v 1.2
34
Estimating distribution parameters easy as long as the RTT distribution does not change Not true in practice!
10 10 10 Bound on probability of prematurely sending out the first retransmission
-2 -3 -4
10
-5
WS 09/10, v 1.2
100
80 60
RTT
40
20
0 0
50
100 Time
150
200
WS 09/10, v 1.2
38
(0,1) a constant, typically = 1, = 4 (in TCP) Deviation is an upper bound of standard deviation, but easier to compute
WS 09/10, v 1.2 Computer Networks - Ch. 8 - Transport layer 39
WS 09/10, v 1.2
40
10
Two examples:
Sender
Orig inal trans miss
Receiver
Sender
Orig inal trans miss
Receiver
SampleR TT
SampleR TT
ion
ion
AC K
The estimation of RTT and basic timeout value is performed as described on previous slide The multiplicative factor for exponential backoff is reset upon ACK arrival
Solution: Do not take RTT samples for retransmitted packets (Karn/Partridge algorithm)
WS 09/10, v 1.2 Computer Networks - Ch. 8 - Transport layer 41
WS 09/10, v 1.2
42
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
Also: firing a timer heavily depends on relatively precise timer interrupts to be available
Sometimes, timeouts can happen only seconds after a packet has been transmitted far too sluggish
WS 09/10, v 1.2
43
WS 09/10, v 1.2
44
11
TCP Summary
TCP consists of
DR
Reliable byte stream error control via GoBack-N or Selective Repeat (depending on version) Congestion control window-based, AIMD, slow start, congestion threshold Flow control advertised receiver window Connection management three-way handshake for setup and teardown
max. TCP BandWidth Max. Segment Size Round Trip Time loss probability
TCP is perhaps the single most complicated and subtle protocol in the internet
Many little details and extensions are not discussed here Interaction of TCP with other layers is more complicated than it looks (e.g., wireless) because of hidden, implicit assumptions
WS 09/10, v 1.2 Computer Networks - Ch. 8 - Transport layer 45
WS 09/10, v 1.2
46
TCP header
0 4 10 SrcPort SequenceNum Acknowledgment HdrLen 0 Checksum Options (variable) Data Flags AdvertisedWindow UrgPtr 16 DstPort 31
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
WS 09/10, v 1.2
47
WS 09/10, v 1.2
48
12
UDP header
Checksum
WS 09/10, v 1.2
49
WS 09/10, v 1.2
50
Overview
Services & addressing Connection setup Connection release Flow control Timer and timeouts TCP summary UDP & RPC Performance issues
Client
Requ est
Blocked
RPC protocol
RPC protocol
Blocked
Network
13
Reduce packet count to reduce software overhead Minimize context switches Minimize copying You can buy more bandwidth but not lower delay Avoiding congestion is better than recovering from it Avoid timeouts Optimize for the common case Depending on network: design for speed, not utilization
Think about the right performance metric, it can be, e.g., energy efficiency rather than throughput or delay
WS 09/10, v 1.2
53
WS 09/10, v 1.2
54
Conclusion
Transport protocols can be anything from trivial to highly complex, depending on the purpose they serve They determine to a large degree the dynamics of a network and in particular its stability
It is trivial to build faster than TCP protocols, but they are unstable
The interdependencies of various mechanisms in a transport protocols can be very subtle with big consequences
E.g., fairness, coexistence of different TCP versions
WS 09/10, v 1.2
55
14