15-441/641: Computer Networks The Transport Layer, Part 1 of 3 - - PowerPoint PPT Presentation

15 441 641 computer networks the transport layer part 1
SMART_READER_LITE
LIVE PREVIEW

15-441/641: Computer Networks The Transport Layer, Part 1 of 3 - - PowerPoint PPT Presentation

15-441/641: Computer Networks The Transport Layer, Part 1 of 3 15-441 Fall 2019 Profs Peter Steenkiste & Justine Sherry Warmup: BGP Refresh X is a small university network with two providers, A and B. As provider is C. Bs


slide-1
SLIDE 1

15-441/641: Computer Networks The Transport Layer, Part 1 of 3

15-441 Fall 2019 Profs Peter Steenkiste & Justine Sherry

slide-2
SLIDE 2

Warmup: BGP Refresh

  • X is a small university network with two providers, A and B.
  • A’s provider is C.
  • B’s provider is D.
  • C’s provider is Z.
  • D’s provider is Z.

What AS path does traffic take from A to B?

  • Why?
slide-3
SLIDE 3

X A B C D Z

slide-4
SLIDE 4

X A B C D Z

Path #1

slide-5
SLIDE 5

X A B C D Z

Path #2 Path #1

slide-6
SLIDE 6

X A B C D Z

Path #2 Path #1

Shortest

slide-7
SLIDE 7
slide-8
SLIDE 8

Gao-Rexford Conditions

  • If I receive a route announcement from my customer, I will announce

that route to my customers, peers, and my providers.

  • If I receive a route announcement from my peer, I will announce that

route only to my customers.

  • If I receive a route announcement from my provider, I will announce

that route only to my customers.

I only want to carry traffic that will earn me a profit!

slide-9
SLIDE 9

Gao-Rexford: “Scrooge McDuck Policy”

slide-10
SLIDE 10

X A B C D Z

Path #2 Path #1 X would never announce a route for B to A

slide-11
SLIDE 11

X A B C D Z

Path #2 Path #1

True Path

slide-12
SLIDE 12

Another BGP Warmup

  • A’s provider is Z. A peers with B.
  • B’s provider is Z. B peers with A and C.
  • C’s provider is Y. C peers with B.
  • Z’s provider is X.
  • Y’s provider is X.

What AS path does traffic take from A to C?

  • Why?
slide-13
SLIDE 13

A B C Y Z X

Follow the money!

slide-14
SLIDE 14

Today

  • Starting three lectures on the transport layer.
  • The transport layer is currently one of my primary areas of research.
  • I’ll teach you the basics….
  • For lecture #3, our TA Ranysha is going to tell you about her PhD

research on modern transport on the Internet.

  • Including new protocols from companies like Google and Akamai
slide-15
SLIDE 15

Quick Review

slide-16
SLIDE 16

Transport Layer in the Internet Model

Transport Network Datalink Physical Transport Network Datalink Physical Network Datalink Physical Application Application

Host A Host B Router

slide-17
SLIDE 17

Why a transport layer?

  • IP packets are addressed to a host but end-to-end communication

is between application processes at hosts

  • Need a way to decide which packets go to which applications

(multiplexing/demultiplexing)

slide-18
SLIDE 18

Why a transport layer?

Transport Network Datalink Physical Transport Network Datalink Physical Application Application

Host A Host B

slide-19
SLIDE 19

Why a transport layer?

Transport Network Datalink Physical Application

Host A Host B

Datalink Physical

browser telnet mmedia ftp browser

IP

many application
 processes

Drivers
 +NIC Operating 
 System

slide-20
SLIDE 20

Why a transport layer?

Host A Host B

Datalink Physical

browser telnet mmedia ftp browser

IP

many application
 processes

Datalink Physical

telnet ftp

IP

HTTP 
 server

Transport Transport Communication 
 between hosts

(128.4.5.6 162.99.7.56)

Communication
 between processes at hosts

slide-21
SLIDE 21

Role of the Transport Layer

  • Communication between application processes
  • Mux and demux from/to application processes
  • Implemented using ports
  • You know this from Liso project!
slide-22
SLIDE 22

Why a transport layer?

  • IP packets are addressed to a host but end-to-end communication

is between application processes at hosts

  • Need a way to decide which packets go to which applications (mux/

demux)

  • IP provides a weak service model (best-effort)
  • Packets can be corrupted, delayed, dropped, reordered, duplicated
  • No guidance on how much traffic to send and when
  • Dealing with this is tedious for application developers
slide-23
SLIDE 23

Role of the Transport Layer

  • Communication between application processes
  • Provide common end-to-end services for app layer [optional]
  • Reliable, in-order data delivery
  • Well-paced data delivery
  • too fast may overwhelm the network
  • too slow is not efficient
slide-24
SLIDE 24

Role of the Transport Layer

  • Communication between processes
  • Provide common end-to-end services for app layer [optional]
  • TCP and UDP are the common transport protocols
  • also SCTP, MTCP, SST, RDP, DCCP, …
slide-25
SLIDE 25

Context: Applications and Sockets

  • Socket: software abstraction by which an application process exchanges

network messages with the (transport layer in the) operating system

  • socketID = socket(…, socket.TYPE)
  • socketID.sendto(message, …)
  • socketID.recvfrom(…)
  • Two important types of sockets
  • UDP socket: TYPE is SOCK_DGRAM
  • TCP socket: TYPE is SOCK_STREAM
slide-26
SLIDE 26

Role of the Transport Layer

  • Communication between processes
  • Provide common end-to-end services for app layer [optional]
  • TCP and UDP are the common transport protocols
  • UDP is a minimalist, no-frills transport protocol
  • only provides mux/demux capabilities
slide-27
SLIDE 27

UDP: User Datagram Protocol

  • Lightweight communication between processes
  • Avoid overhead and delays of ordered, reliable delivery
  • UDP described in RFC 768 – (1980!)
  • Destination IP address and port to support demultiplexing
  • Optional error checking on the packet contents
  • (checksum field = 0 means “don’t verify checksum”)

SRC port DST port checksum length DATA

slide-28
SLIDE 28

What is a checksum?

  • Wikipedia: “A checksum is a small-sized datum derived from a block of digital

data for the purpose of detecting errors that may have been introduced during its transmission or storage.”

  • Simplest checksum:
  • Take every, say, 32-bit word and XOR them all together
  • Append the result to the end of the packet (adds overhead!)
  • At the receiver, re-compute the XOR. If it does not match the appended

checksum, you know some of the data has been corrupted.

  • There is a huge literature on “coding” checksumming schemes.

Take a class from Prof. Vinayak to learn more about information theory and how to use it to build systems!

slide-29
SLIDE 29

UDP

  • That’s literally the entire protocol.
  • If a packet gets lost, it’s up to the application developer to decide

what to do about it.

slide-30
SLIDE 30

Role of the Transport Layer

  • Communication between processes
  • Provide common end-to-end services for app layer [optional]
  • TCP and UDP are the common transport protocols
  • UDP is a minimalist, no-frills transport protocol
  • TCP is the whole-hog protocol
  • offers apps a reliable, in-order, bytestream abstraction
  • with congestion control
  • but no performance guarantees (delay, bw, etc.)
slide-31
SLIDE 31

Why a transport layer?

  • IP packets are addressed to a host but end-to-end communication

is between application processes at hosts

  • Need a way to decide which packets go to which applications (mux/

demux)

  • IP provides a weak service model (best-effort)
  • Packets can be corrupted, delayed, dropped, reordered, duplicated

TCP, literally the next three lectures

slide-32
SLIDE 32

Getting this right is *hard* and hence it is an active area of research.

slide-33
SLIDE 33

Let’s get started understanding why this is challenging… I need two volunteers.

slide-34
SLIDE 34

Team Structure

  • I have ten beanbags labeled 1 to 10.
  • Your job is to transport them from one end of the classroom to the other.
  • Like Professor Sherry, you must throw them — you can’t simply carry them

to the other side of the classroom.

  • Unlike Professor Sherry, you may have better aim.
  • Or they might fall to the ground. If they fall, you can’t pick them back up!
  • If you determine that a beanbag is lost, you can grab another beanbag,

label it with the missing number, and re-transmit it.

slide-35
SLIDE 35

Team Structure

  • Two of you are the end points (sender/receiver) who decide what packets to

transmit, and whether or not to re-transmit. The endpoints must face the wall — they can’t see the network. But, they can talk!

  • The other two represent the network in the middle. You can see everything,

but you can’t talk or signal in any way to the endpoints.

  • The sender will will hold up a bean bag in the air if they have a bag they

want you deliver.

  • They receiver will hold up their hand so you can put beanbags into it.
  • But otherwise no talking! Just try not to let the beanbags fall!
slide-36
SLIDE 36

PRIZES

  • The winner is whoever successfully gets beanbags numbered 1…10

to their receiver first.

  • Winning team gets t-shirts
  • Losing team still gets candy!
slide-37
SLIDE 37

Back to the real Internet…

slide-38
SLIDE 38

How do we tell that a packet has been lost?

  • The packet was sent a long time ago, but still has not arrived
  • Packet arrives at receiver, but data does not match its checksum
slide-39
SLIDE 39

A basic protocol: Stop and Wait

Sender Receiver

slide-40
SLIDE 40

A basic protocol: Stop and Wait

Sender Receiver Packet 1

Each packet carries a sequence number identifying it as the first, second, third… etc packet.

slide-41
SLIDE 41

A basic protocol: Stop and Wait

Sender Receiver Packet 1 ACK 1

ACK stands for ACKNOWLEDGED Include sequence number for the packet being acknowledged.

slide-42
SLIDE 42

A basic protocol: Stop and Wait

Sender Receiver Packet 1 ACK 2 Packet 2 ACK 2

slide-43
SLIDE 43

How do we tell that a packet has been lost?

slide-44
SLIDE 44

A basic protocol: Stop and Wait

Sender Receiver Packet 3 Set timer… Packet 3 ACK 3

Retransmit if I haven’t received an ACK by the time the timer goes off.

slide-45
SLIDE 45

How do we tell that a packet has been lost?

  • The packet was sent a long time ago, but still has not arrived
  • Packet arrives at receiver, but data does not match its checksum
slide-46
SLIDE 46

A basic protocol: Stop and Wait

Sender Receiver Packet 5 Set timer… Packet 5 ACK 5

Just ignore it….

$#!@$@

slide-47
SLIDE 47

Stop-and-Wait: Summary

  • Sender:
  • Transmit packets one by one. Label each with a sequence number. Set timer

after transmitting.

  • If receive ACK, send the next packet.
  • If timer goes off, re-send the previous packet.
  • Receiver:
  • When receive packet, send ACK.
  • If packet is corrupted, just ignore it — sender will eventually re-send.
slide-48
SLIDE 48

Why do we need sequence numbers? Could we use Stop-and-Wait without them?

slide-49
SLIDE 49

Intuitive Need for Sequence Numbers…

1 2 3 4… 1 2 3 4… How do we put the file back together again after packetization?

But maybe we could just standardize this —- say each packet is in row-order starting from top

  • left. Would we still need sequence numbers for the protocol?
slide-50
SLIDE 50

We do, and here’s why…

Sender Receiver Packet 3 is sent ACK Packet 3 is retransmitted

slide-51
SLIDE 51

Sequence numbers are needed for reliability.

slide-52
SLIDE 52

What’s wrong with stop-and- wait?

slide-53
SLIDE 53

It’s slow!

slide-54
SLIDE 54

How might we fix it?

slide-55
SLIDE 55

Making Stop and Wait faster…

Sender Receiver Packet 1 ACK 1 Packet 2 ACK 2 Packet 3 ACK 3 Packet 4 ACK 4

slide-56
SLIDE 56

…and faster…

Sender Receiver Packet 1 ACK 1 Packet 2 ACK 2 Packet 3 ACK 3

slide-57
SLIDE 57

Key idea: “windowing”

slide-58
SLIDE 58

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Windowing improves the efficiency of a transport protocol.
  • We say the window “slides” when a packet is asked.

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7

Window size = 3 Send!

slide-59
SLIDE 59

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Windowing improves the efficiency of a transport protocol.
  • We say the window “slides” when a packet is asked.

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7

ACK 1

slide-60
SLIDE 60

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Windowing improves the efficiency of a transport protocol.
  • We say the window “slides” when a packet is asked.

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7

slide-61
SLIDE 61

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Windowing improves the efficiency of a transport protocol.
  • We say the window “slides” when a packet is asked.

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7

ACK 2

slide-62
SLIDE 62

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Windowing improves the efficiency of a transport protocol.
  • We say the window “slides” when a packet is asked.

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7

slide-63
SLIDE 63

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Sliding windows improve the efficiency of a transport protocol.
  • Two questions we need to answer to use windows:
  • (1) How do we handle loss with a windowed approach?
  • (2) How big should we make the window?
slide-64
SLIDE 64

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Sliding windows improve the efficiency of a transport protocol.
  • Two questions we need to answer to use windows:
  • (1) How do we handle loss with a windowed approach?
  • (2) How big should we make the window?
slide-65
SLIDE 65

Approach #1: Go Back N

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2

Not the expected packet — 3 — so ignore.

Packet 6 Packet 7 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7

slide-66
SLIDE 66

Go Back N

  • Sender:
  • Send up to {n} packets at a time. Set a timeout timer for every packet.
  • On receiving an ACK, slide the window forward.
  • On timeout, retransmit the timeout packet, and everything after it in the window.
  • Receiver:
  • On receive next expected sequence number, send an ACK
  • If packet is corrupted or has an unexpected sequence number, ignore it.
slide-67
SLIDE 67

We don’t use Go Back N on the Internet… why not?

slide-68
SLIDE 68

Loss recovery *works*… but it’s not very efficient.

slide-69
SLIDE 69

Approach #1: Go Back N

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7

Ignoring these packets is wasteful!

slide-70
SLIDE 70

Approach #2: Selective Repeat

slide-71
SLIDE 71

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2

Window moves forward

slide-72
SLIDE 72

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet 8 Packet 9

slide-73
SLIDE 73

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet 8 Packet 9

slide-74
SLIDE 74

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7

slide-75
SLIDE 75

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7 ACK 4 ACK 5

slide-76
SLIDE 76

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7 ACK 4 ACK 5

Window cannot move forward

ACK 6 ACK 7

slide-77
SLIDE 77

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet 8 Packet 9

Missing packet 3 stops the window from moving forward

slide-78
SLIDE 78

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7 ACK 4 ACK 5 ACK 6 ACK 7

slide-79
SLIDE 79

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7 ACK 4 ACK 5 ACK 3 Packet 3 ACK 6 ACK 7

slide-80
SLIDE 80

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet 8 Packet 9

slide-81
SLIDE 81

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet 8 Packet 9

slide-82
SLIDE 82

Approach #2: Selective Repeat

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK 1 ACK 2 Packet 6 Packet 7 ACK 4 ACK 5 ACK 3 Packet 3 Packet 8 Packet 9 …. ACK 6 ACK 7

slide-83
SLIDE 83

Selective Repeat

  • Sender:
  • Send packets from the window. Set timeout for each packet.
  • On receiving ACKs for the “left side” of the window, slide forward.
  • Send packets that have now entered the window.
  • On timeout, retransmit only the timed out packet
  • Receiver
  • Keep a buffer of size of the window.
  • On receiving packets, send ACKs for every packet.
  • If packets come in out of order, just store them in the buffer and send ACK anyway.
slide-84
SLIDE 84

Receive Buffer

TCP Liso Server

1 2

slide-85
SLIDE 85

Receive Buffer

TCP Liso Server

1 2

read()

slide-86
SLIDE 86

Receive Buffer

TCP Liso Server

1 2

read()

slide-87
SLIDE 87

Receive Buffer

TCP Liso Server

3 4

slide-88
SLIDE 88

Receive Buffer

TCP Liso Server

3 4 6 7 8 9

slide-89
SLIDE 89

Receive Buffer

TCP Liso Server

read()

3 4 6 7 8 9

slide-90
SLIDE 90

Receive Buffer

TCP Liso Server

read()

3 4 6 7 8 9

slide-91
SLIDE 91

Receive Buffer

TCP Liso Server

3 4 6 7 8 9 10 11

slide-92
SLIDE 92

Receive Buffer

TCP Liso Server

Application can’t take in any packets until missing packet comes in

3 4 6 7 8 9 10 11

slide-93
SLIDE 93

Handling Loss

  • Go-Back-N and Selective Repeat both handle loss, while allowing

lots of packets in flight.

  • Selective repeat is more efficient at recovering from failure.
slide-94
SLIDE 94

What does TCP Do?

  • TCP is like Selective Repeat, but…
  • It uses cumulative ACKs
  • Instead of using per-packet sequence numbers, it uses per-byte

sequence numbers.

  • e.g. if packet #1 has 1000 bytes of payload data, packet #2 will

have the sequence number 1001

  • It implements fast recovery (we’ll discuss this on Tuesday)
slide-95
SLIDE 95

Basic ACKs vs Cumulative ACKs

  • Basic ACKs: “ACK n” means “I just received packet n”
  • Cumulative ACKs: “ACK n” means, “I have received all packets up

until n-1, I am now expecting to get n”

  • Why might a cumulative ACK be better than a “Basic ACK”?
slide-96
SLIDE 96

Cumulative ACK

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK2 ACK 3 Packet 6 Packet 7 ACK 3 ACK 3

slide-97
SLIDE 97

Cumulative ACK: Recover from Lost ACKs Easily

Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 ACK2 ACK 3 Packet 6 Packet 7 ACK 4 ACK 5 ACK 6

slide-98
SLIDE 98

What does TCP Do?

  • TCP is like Selective Repeat, but…
  • It uses cumulative ACKs
  • Instead of using per-packet sequence numbers, it uses per-byte

sequence numbers.

  • e.g. if packet #1 has 1000 bytes of payload data, packet #2 will

have the sequence number 1001

  • It implements fast recovery (we’ll discuss this on Tuesday)
slide-99
SLIDE 99

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Sliding windows improve the efficiency of a transport protocol.
  • Two questions we need to answer to use windows:
  • (1) How do we handle loss with a windowed approach?
  • (2) How big should we make the window?

You now know most of this

slide-100
SLIDE 100

Sliding Windows

  • A sender’s “window” contains a set of packets that have been

transmitted but not yet acked.

  • Sliding windows improve the efficiency of a transport protocol.
  • Two questions we need to answer to use windows:
  • (1) How do we handle loss with a windowed approach?
  • (2) How big should we make the window?
slide-101
SLIDE 101

We’ll figure this out on Thursday.

slide-102
SLIDE 102

Have a great afternoon!