Lecture19 Reliable Transport
Lecture19 Reliable Transport
Computer Networks:
Architecture and Protocols
Lecture 19
Reliable Transport
Rachit Agarwal
1
Goal of Today’s Lecture
• Understanding reliable transport conceptually
• What are the fundamental aspects of reliable transport
2
You must think for yourself
• Today’s lecture requires you to engage
• How would I design a reliable service
3
Decisions and Their Principles
• How to break system into modules?
• Dictated by layering
4
Today We Design Reliable Delivery
• The end-to-end principle tells us?
• Put reliability in the end-host, not the network
5
Best Effort Service (L3)
• Packets can be lost
• Packets can be corrupted
• Packets can be reordered
• Packets can be delayed
• Packets can be duplicated
• …
6
Making Best Effort Service Work
• Engineer network so that average case is decent
• You can’t make guarantees, but the operator must try…
7
Reliable Transport is Necessary
• Some app semantics involve reliable transport
• E.g., file transfer
• Today’s question:
• How can we build a reliable transport service on top of arbitrary
unreliable packet delivery?
• A central challenge in bridging the gap between
• The abstractions application designers want
• The abstractions networks can easily support
8
Important Distinctions
• For functionality implemented in network:
• Keep minimal (easy to build, broadly applicable)
9
Two Different Statements
• Some applications need reliable service
• This means that the applications writers should be able to assume
this, to make their job easier
• The network must provide reliable service
• This contends that end-hosts cannot implement this functionality,
so the network must provide it
• Today we’re making the first statement and refuting the second…
• And this simple observation is what the advocates of reliable
networks (as in telephony) never understood
10
Challenge For Today
• Building a stack that supports reliable transfer
• So that individual applications don’t need to deal with packet
losses, etc.
• What mechanisms can we put in the transport layer to provide reliability?
11
Fundamental Systems Question
• How to build reliable services over unreliable components
• File systems, databases, etc.
12
Four Goals for Reliable Transfer
• Correctness
• To be defined
• “Fairness”
• Every flow must get a fair share of network resources
• Flow Performance
• Latency, jitter, etc.
• Utilization
• Would like to maximize bandwidth utilization
• If network has bandwidth available, flows should be able to use it!
13
Start With Transfer of a Single Packet
• We can later worry about larger files, but in the beginning it is cleaner
to focus on this simple case
14
Correctness Condition
• Routing had a clean correctness condition
• This condition is for the design to be correct, not the best performant
15
Correctness Condition?
• How about: “Packet is always delivered to receiver”?
16
WRONG!
• What if network is partitioned?
• Partitioned means that the network is broken into two or more
disconnected components…
• We can’t claim a transport design is incorrect if it doesn’t work in a
partitioned network!
• After all, there is no way to reach the destination!
17
Correctness Condition?
• Packet is delivered to receiver if and only if its possible to deliver packet
18
WRONG!
• If the network is only available at one instant of time, only an Oracle
would know when to send
• We can’t claim a transport design is incorrect if it doesn’t know the
unknowable…
• So we need to focus on what the transport design is trying to do, not
what it actually accomplishes
19
Correctness Condition?
• Resend packet if and only if the previous transmission was lost or
corrupted
• This is better because it refers to:
• what the design does (which it can control)
• not whether it always succeeds (which it can’t)
20
WRONG!
• Impossible
• “Coordinated Attack” over an unreliable network
21
Correctness Condition?
• Packet is always resent if the previous transmission was lost or corrupted
• Packet may be resent at other times
• Note:
• This invariant gives us a simple criterion for deciding if an
implementation is correct
• Efficiency and simplicity are separate criteria
22
Almost Right!
• What’s wrong with it?
23
Complete Correctness Condition
• A transport mechanism is “reliable” if and only if
(a) It resends all dropped or corrupted packets
(b) It attempts to make progress
24
Complete Correctness Condition
• A transport mechanism is “reliable” if and only if
(a) It resends all dropped or corrupted packets
(b) It attempts to make progress
25
Note!
• A transport mechanism can “give up”, but must announce this to
application
• If the transport mechanism has tried for some period to deliver the
data, and has not succeeded:
• It might decide that it is better to give up
• And applications can reinitiate data transfer
• That is allowed…
26
We have Correctness Condition
• How do we achieve it?
27
Back to Correctness Condition
• How do we achieve it?
28
Four Goals for Reliable Transfer
• Correctness
• “Fairness”
• Every flow must get a fair share of network resources
• Flow Performance
• Latency, jitter, etc.
• Utilization
• Would like to maximize bandwidth utilization
• If network has bandwidth available, flows should be able to use it!
29
Solution v1
• Send every packet as often and fast as possible…
• Is it correct
• No.
• Why?
• The “if” condition is not satisfied:
(a) Transport must attempt to make progress
• No way to check whether the packet was dropped or corrupted
• So, must continue sending the same packet
30
What’s missing?
• Feedback from receiver!
• If receiver does not respond, no way for sender to tell when to stop
resending
• Cannot achieve correctness without feedback
31
Forms of Feedback
• ACK: Yes, I got a packet
32
Solution v2
• Resend packet until you get an ACK
• And receiver sends per-packet ACKs until data finally stops
• Correct?
• Yes:
• All dropped/corrupted packets will be retransmitted
• The transport will attempt to make progress
• Fair?
• Over long-term, yes:
• all sources will get an equal chance to use network resources
• Flow performance?
• Good but not necessarily optimal
• Some packets may be retransmitted unnecessarily
• Efficiency:
• suboptimal; packets retransmitted unnecessarily
33
Solution v3
• Send packet
• But now, set a timer
• When receiver gets packet, sends ACK
• If sender receives ACK, done
• If no ACK when timer expires, resend
34
Have “Solved” the Single Packet Case
• Send packet
• Set a timer
• If no ACK when timer goes off, resend packet
• And reset timer
35
Multiple Packets
• Service model: reliable stream of packets
• Hand up contiguous block of packets to application
36
Window-based Algorithms
• Very simple concept
• Send W packets
• When one gets ACK’ed send the next packet in line
• It really is that simple (until we got to TCP)
37
How Big Should the Window be?
• Windows serve three purposes
• Taking advantage of the bandwidth of the links
• Limiting bandwidth used by a flow (congestion control)
• Limiting the amount of buffering needed at the receiver
• Why do receivers need to buffer packets?
• Answer: packet re-ordering (discussed later)
• If we ignore all but the first goal, then we want to keep the sender
always sending (in the ideal case)
• RTT: from sending first packet until received first ACK
• Condition:
• RTT x B ~ W x Packet Size
38
What does this mean?
• B is the minimum link bandwidth along the path
• Obviously shouldn’t send faster than that
• Don’t want to send slower than that (for first goal)
39
RTT x B ~ W x Packet Size
• Recall that Bandwidth Delay Product
• BDP = bandwidth x propagation delay
Propagation delay
40
Where Are We?
• Figured out correctness condition:
• Always resend lost/corrupted packets
• Always try to make progress (but can give up entirely)
41
Three Design Considerations
• Nature of feedback
• What should ACKs tell us when we have many packets in flight
• Detection of loss
• Response to loss
42
Possible Feedback From Receiver
• Ideas?
43
ACK Individual Packets
• Strengths
• Know fate of each packet
• Reordering not a problem
• Simple window algorithm
• W independent single packet algorithms
• When one finishes grab next packet
• Weaknesses?
• Loss of ACK packet requires a retransmission
44
Full Information Feedback
• List all packets that have been received
• Give highest cumulative ACK plus any additional packets
• If packets 1, 2, 3, 5, 6 received: send ACK(3, 5, 6)
• Strengths?
• As much information as you could hope for
• Resilient form of individual ACKs
• Weaknesses?
• Could require sizable overhead in bad cases
• Feasible if only small holes
• If packets 1, 5, 6, …., 100 received: ACK(1, 5, 6, …,100)
45
Cumulative ACK
• ACK the highest sequence number for which all previous packets have
been received
• Implementations often send back “next expected packet”, but that’s
just a detail
• Strengths?
• Resilient to lost ACKs
• Weaknesses?
• Confused by reordering
• Incomplete information about which packets have arrived
46
Detecting Loss
• If packet times out, assume it is lost…
47
Loss With Individual ACKs
• Assume that packet 5 is lost, but no others
48
Loss With Individual ACKs
• Could resend packet when k “subsequent packets” are received
• Response to loss
• Resend missing packet
• Continue window based protocol
49
Loss With Full Information
• Same story, except that the “hole” is explicit in each ACK
50
Loss With Full Information
• Could resend packet when k “subsequent packets” are received
• Response to loss
• Resend missing packet
• Continue window-based protocol
51
Loss With Cumulative ACKs
• Assume packet 5 is lost, but no others
52
Loss With Cumulative ACKs (cont’d)
• Duplicate ACKs are a sign of an isolated loss
• The lack of ACK progress means 5 hasn’t been delivered
• Stream of duplicate ACKs means some packets are being delivered
(one for each subsequent packet)
53
Loss With Cumulative ACKs (cont’d 2)
• Two choices
• Send missing packet and optimistically assume that subsequent
packets have arrived
• i.e., increase W by the number of duplicate ACKs
• Send missing packet, wait for ACK
54
Cumulative ACKs
• They make no sense, except as a cheap alternative to full information
• Less state than full information
• More resilient than individual ACKs
55
All The Bad Things Best Effort Can Do
• Packets can be lost
56
Effect of Reordering?
• For all designs this looks like “subsequent ACKs”
57
Effect of Long Delays?
• Possible timeouts (for all designs)
58
Effect of Duplication
• Produce duplicate ACKs
• Could be confused for loss with cumulative ACKs
• But duplication is rare…
59
Effect of Duplication
• Produce duplicate ACKs
• Could be confused for loss with cumulative ACKs
• But duplication is rare…
60
Possible Design For Reliable Transport
• Full information ACKs
61
Fairness? (Come back to later)
• Adjust W based on losses…
• Short version:
• Loss: cut W by 2
• Successful receipt of window: W increased by 1
62
Overview of Reliable Transport
• Window based self control separate concerns
• Size of W
• Nature of feedback
• Response to loss
63
Many Implementation Choices
• Feedback from receiver: ACKs vs NACKs
• Can NACKs alone achieve correctness
• Can ACKs alone achieve correctness
• Variations on ACKs
• Full information
• Individual packets
• Cumulative (TCP)
• When to resend
• Timeout
• Duplicate ACKs
• NACKs
64
Implementation Choices
• These implementation choices affect:
• Performance
• Utilization
• Fairness
• ..
65
What Have We Done Today?
• Gone from first principles
• Correctness condition for reliable transport
66
We tried to understand:
Why is TCP designed the way it is designed!
Why is almost always the most important question!!!
67