reliable packet transport - mitweb.mit.edu/6.02/www/f2006/handouts/net_l6.pdfhari balakrishnan, sam...

24
6.082 Fall 2006 Reliable Packet Transport, Slide 1 Reliable Packet Transport “Best Efforts” network layer lost packets using ACKnowledgements Timeout and retransmission Optimizing performance

Upload: others

Post on 10-Feb-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 1

    Reliable PacketTransport

    • “Best Efforts” network layer → lost packets• using ACKnowledgements• Timeout and retransmission• Optimizing performance

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 2

    Abstraction Layers

    Link Layer:Channel access, how bits are transmitted on the channel,framing of data, channel-specific addressing, channel coding.

    Network Layer (eg, IP):Addressing and routing fixed-length datagrams through amulti-hop network, breaking up larger packets

    Transport Layer (eg, TCP or UDP):Using packets to create illusion of continuous stream ofdata. In-order, connection-based vs. connectionless

    Application Layer:HTTP, Mail, FTP, Telnet, RPC, DNS, NFS

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 3

    “Best Efforts” Network Layer• Packets lead a rough life – they can be lost by the

    network for any number of reasons– No current route to destination

    • Before transmission is initiated• After packet enters network

    – Queue overflow on communications links– Loss of framing on communication channel– Uncorrectable errors detected by CRC– Queue overflow at receiving node

    • Rather than tackle each problem separately, adopt an end-to-end approach– Use a single remedy for lost packets, regardless of how

    they got lost– Implement in sender and receiver, not a concern for

    intermediate nodes

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 4

    • Network layer provides best-effort service– Loss, delay, variable latency, duplicates, reordering, …– Not convenient for applications

    • Transport layer builds on the best effort service to provide applications with a convenient environment– Reliability:

    • at least once• at most once

    – Performance:• flow and congestion control

    – Ordering– Data integrity (checksum)– Timeliness (remove variable latency)

    • Also transport provides multiplexing between multiple applications

    Transport Layer

    Slides are from lectures by Nick Mckeown, Ion Stoica, Frans Kaashoek, Hari Balakrishnan, Sam Madden, and Dina Katabi

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 5

    At Least Once

    • Sender persistently sends until it receives an ack• How long should the timeout be?

    – Fixed is bad. RTT changes depending on congestion• Pick a values that’s too big and it will wait too long to

    retransmit a packet, • Pick a value too small, and it will unnecessarily retransmit

    packets.– Adapt the estimate of RTT adaptive timeout

    Timeout and Retransmission

    an RTT

    Host A Host BData 1

    Data 2

    ACK

    Host A Host BData 1

    Data 1

    X

    RTT = round trip time

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 6

    RTT Measurements(collected by Caida)

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 7

    At Most Once• Suppress duplicates• Packets must have ids to allow the receiver to

    distinguish a duplicate from a new packet• Receiver should keep track of which packet ids

    have been delivered to applications– Discard arriving packets that have already been delivered

    (duplicate packets happen when ACKs get lost and sender retransmits not knowing the packet has been delivered).

    • To simplify tracking, senders pick monotonically increasing packet ids, i.e., sequence numbers

    • Receiver delivers packets to application in order. It keeps track of the largest id delivered so far

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 8

    How fast should the sender send?

    • Waiting for acks is too slow• Throughput is one packet/RTT

    – Say packet is 500B – RTT 100ms – Throughput = 40Kb/s, Awful!

    • Overlap transmission of new data packets with acks from previous data packets

    Host A Host BData 1

    Data 2

    ACK

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 9

    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 ackedtoo slow

    Host A Host B

    Send?

    OK, 3 pkts

    Idle

    2-4

    5-7

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 10

    Sliding Window• Senders advances the

    window whenever it receives an ack sliding window

    • But what is the right value for the window?

    • Note that– if W/RTT < Bottleneck

    Capacity under utilization

    – If W/RTT > Bottleneck Capacity Large queues

    Host A Host B

    Send?

    OK, 3 pkts

    Idle

    2-4

    3-5

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 11

    Src

    Rcvr

    window = 2-6

    1 2 3 4 5

    p1

    a2

    x

    6

    a2

    p3

    Example

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 12

    Src

    window = 2-6

    1 2 3 4 5

    p1

    a2

    x

    6

    a2

    p3

    a2

    p4

    a2

    p6

    a2

    p5

    Timeout

    2

    a7

    p2Rcvr

    Example

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 13

    Src

    window = 7-11

    1 2 3 4 5

    p1

    a2

    x

    6

    a2

    p3

    a2

    p4

    a2

    p6

    a2

    p5

    Timeout

    2

    a7

    p2

    7 8 9 10 11

    Rcvr

    In this example, the receiver sent cumulative acks, but the same behavior happens if the receiver acks the received sequence number

    Example

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 14

    What is the right window size?• The window limits how fast the sender sends• Two mechanisms control the window:

    – Flow control – Congestion control

    • Flow control:– The receiver may be slow in processing the packets

    receiver is a bottleneck– To prevent the sender form overwhelming the receiver,

    the receiver tells the sender the maximum number of packets it can buffer: fwnd

    – Sender sets W ≤ fwnd

    But, what if the bottleneck is a slow link inside the network Need Congestion Control

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 15

    Sharing the Internet

    How do you manage the resources in a huge system like the Internet, where users with different interests share the same resources?

    Difficult because of:• Size

    – Millions of users, links, routers• Heterogeneity

    – bandwidth: 9.6kb/s (then modem, now cellular), 10 Tb/s – latency: 50us (LAN), 133ms (wired), 1s (satellite), 260s (Mars)

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 16

    Congestion

    S1

    S2

    R1 D10Mb/s

    2Mb/s

    100Mb/sS1

    S2

    Sources share links,and buffer space

    Why a problem?Sources are unaware of current state of resourceSources are unaware of each other

    Manifestations:Lost packets (buffer overflow at routers)Long delays (queuing in router buffers)

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 17

    Congestion CollapseIncrease in input traffic leads to decrease in useful work

    Input traffic

    Thro

    ughp

    ut cliffCongestion Collapse

    knee

    Latency

    Causes of Congestion CollapseSpurious retransmissions of packets that are still in flightPacket consume resources and then they are dropped downstream

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 18

    How do senders learn of congestion?

    Potential options:• Router sends a Source Quench to the sender • Router flags the packets indicating congestion• Router drops packets when congestion occurs

    – Sender learns about the drop because it notices the lack of ack

    – Drops are the solution currently used in the Internet

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 19

    How do senders learn how much to send?

    • Define a congestion control window cwnd• Sender’s window is set to W = min (fwnd, cwnd)• Simple heuristic to find cwnd:

    – Sender increases its cwnd slowly until it sees a drop– Upon a drop, sender decreases its cwnd quickly to react

    to congestion– Sender increases again slowly

    • TCP: Additive Increase / Multiplicative Decrease– Every RTT: No drop: cwnd = cwnd + 1

    drop: cwnd = cwnd /2

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 20

    Additive Increase

    D A

    Src

    Rcvr

    cwnd = 1cwnd += 1cwnd = 2

    D D A A

    cwnd = 3

    D D A AD A

    cwnd = 4

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 21

    TCP AIMD

    Time

    Cwnd

    Grab capacity again

    Halve Cwnd

    Timeout because of a packet loss

    desired cwnd

    Need the queue to absorb these saw-tooth oscillations

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 22

    TCP “Slow Start”

    D A D D A A D D

    A A

    D

    A

    Src

    Rcvr

    D

    A

    1 2 4 8

    A A A A

    How to set the initial cwnd?At the beginning of a connection, increase exponentially

    Every RTT, double cwnd

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 23

    Slow Start + AIMD

    Time

    Cwnd

    Slow start

    Additive increase

    Multiplicative decrease

    Timeout

  • 6.082 Fall 2006 Reliable Packet Transport, Slide 24

    Summary• It’s possible to build a reliable transport protocol

    on top of an unreliable delivery service• Sender and receiver cooperate in ACK/retransmit

    scheme– It’s end-to-end since intermediate nodes and links don’t

    participate in scheme except for delivering packets just as they’ve always done.

    • Want control parameters to adapt to changing network conditions– If parameters are too conservative, network capacity

    goes unused– If parameters are too aggressive, problem cascades and

    network performance degrades dramatically