L12: end to end layer
description
Transcript of L12: end to end layer
![Page 1: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/1.jpg)
L12: end to end layer
Dina Katabi6.033 Spring 2007
http://web.mit.edu/6.033Some slides are from lectures by Nick Mckeown, Ion Stoica,
Frans Kaashoek, Hari Balakrishnan, Sam Madden,
and Robert Morris
![Page 2: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/2.jpg)
End-to-end layer
stubstub
Network Layer
Link Layer
presentation Layer
End-to-end layer
RPC RPC
HD
HD
HD
HD HD
HD
HeaderData HeaderData
client server
![Page 3: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/3.jpg)
• Packets may be:• Lossed• Delayed (jitter)• Duplicated • Reordered• …
• Problem: Inconvenient service for applications
• Solution: Design protocols for E2E modules• Many protocols/modules possible, depending on
requirements
Network layer providesbest effort service
![Page 4: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/4.jpg)
This lecture: some E2E properties
• At most once• At least once
• Exactly once?
• Sliding window• Case study: TCP• Tomorrow: Network File System
(NFS)
![Page 5: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/5.jpg)
At Least Once
• Sender persistently sends until it receives an ack• Challenges:
• Duplicate ACKs• What value for timer
Timeout and Retransmission
an RTT
client server
DataData
ACKACK
client server
DataData
DataData
X
![Page 6: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/6.jpg)
Duplicate ACK problem
• Problem: Request 2 is not delivered• violates at-least once delivery
timeout
Client Server
Req 1Req 1
Req 1Req 1
ACKACK
Req 2Req 2
Req 3Req 3
ACKACK
![Page 7: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/7.jpg)
Solution: nonce
• Label request and ack with unique identifier that is never re-used
timeout
Client Server
Req N1Req N1
Req N1Req N1
ACK N1ACK N1
Req N2Req N2
Req N2Req N2
ACK N1ACK N1
N1
N2
![Page 8: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/8.jpg)
Engineering a nonce
• Use sequence numbers
• Challenges: • Wrap around?• Failures?
Client Server
Req 1Req 1
Req 1Req 1
ACK 1ACK 1
Req 2Req 2
Req 2Req 2
ACK 1ACK 1
1
2
timeout
![Page 9: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/9.jpg)
• Fixed is bad. RTT changes depending on congestion• Pick a value that’s too big, wait too long to
retransmit a packet • Pick a value too small, generates a duplicate
(retransmitted packet).
• Adapt the estimate of RTT adaptive timeout
Timer value
![Page 10: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/10.jpg)
RTT Measurements(collected by Caida)
![Page 11: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/11.jpg)
Adaptive Timeout: Exponential weighted moving
averages• Samples S1, S2, S3, ..
• Algorithm• EstimatedRTT = T0
• EstimatedRTT = α S + (1- α) EstimatedRTT• where 0 ≤ α ≤ 1
• What values should one pick for α and T0?• Adaptive timeout is also hard
![Page 12: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/12.jpg)
At Most Once Challenges
client server
Req 1Req 1
req 1req 1
Ok
ACK 1Ok
ACK 1
ACK 1ACK 1
• Server shouldn’t process req 1• Server should send result preferably
1
2
Process request 1
Process request 1
![Page 13: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/13.jpg)
Idea: remember sequence number
client server
Req 1Req 1
req 1req 1
Ok
ACK 1Ok
ACK 1
• Server remembers also last few responses
1
1
2
OkACK 1
OkACK 1
Ok
ACK 1Ok
ACK 1Resend ACK 1
Process request 1
![Page 14: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/14.jpg)
Problem: failuresclient server
Req 1Req 1
req 1req 1
Ok
ACK 1Ok
ACK 1
• Performed request 1 twice!• How to maintain the last nonce per sender (tombstone)?
• Write to non-volatile storage?• Move the problem? (e.g., different port number)• Make probability of mistake small?
• How about exactly once? (Need transactions)
1
1
2
OkACK 1
OkACK 1
Ok
ACK 1Ok
ACK 1
0
0
1
OkACK 1
OkACK 1
![Page 15: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/15.jpg)
How fast should the sender sends?• Waiting for acks is too
slow• Throughput is one
packet/RTT• Say packet is 500 bytes• RTT 100ms Throughput = 40Kb/s,
Awful!
• Overlap pkt transmission
Host A Host B
Data 1Data 1
Data 2Data 2
ACKACK
![Page 16: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/16.jpg)
Send a window of packets
• Assume the receiver is the bottleneck• Maybe because the
receiver is a slow machine
• Receiver needs to tell the sender when and how much it can send
• The window advances once all previous packets are acked too slow
Host A Host B
Send?
OK, 3 pkts
Idle
2-4
5-7
![Page 17: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/17.jpg)
Sliding Window
• Senders advances the window whenever it receives an ack sliding window
• But what is the right value for the window?
Host A Host B
Send?
OK, 3 pkts
Idle
2-4
3-5
![Page 18: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/18.jpg)
The Right Window Size
• Assume server is bottleneck• Goal: make idle time on server zero• Assume: server rate is B bytes/s• Window size = B x RTT• Danger: sequence number wrap around
• What if network is bottleneck?• Many senders?• Sharing?• Next lecture
![Page 19: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/19.jpg)
“Negative” ACK
• Minimize reliance on timer
• Add sequence numbers to packets
• Send a Nack when the receiver finds a hole in the sequence numbers
• Difficulties• Reordering• Cannot eliminate acks,
because we need to ack the last packet
Host A Host B
D1D2D3
D1
D3
X
D2
D4
Nack-2
![Page 20: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/20.jpg)
E2E layer in Internet
Network
Link
Transport
The 4-layer Internet model
ApplicationHTTP, RTP, Sun RPC, …
IP
TCP or UDP
Ethernet, WiFI, ...
End-to-End Layer
![Page 21: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/21.jpg)
UDP
![Page 22: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/22.jpg)
Transmission Control Protocol (TCP)
Host A Host B
Syn x
Data x+1, ack y+1
ack x+1, syn
y
y, x+1x,?
x+1, y+1
• Connection-oriented
• Delivers bytes at-most-once
• Bidirectional• ACKs are
piggybacked
![Page 23: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/23.jpg)
TCP header
![Page 24: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/24.jpg)
Closing a TCP connection
Host A Host B
fin x
ack x+1
y, xx,y
fin y
ack y+1
closed
timed wait
timeout closed
![Page 25: L12: end to end layer](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815854550346895dc5b112/html5/thumbnails/25.jpg)