37
CS144, Stanford University CS144 An Introduction to Computer Networks Packet Switching What is packet switching? Nick McKeown Stephen Ibanez Professor of Electrical Engineering and Computer Science, Stanford University

What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

CS144An Introduction to Computer Networks

Packet SwitchingWhat is packet switching?

Nick McKeown Stephen IbanezProfessor of Electrical Engineering and Computer Science, Stanford University

Page 2: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 2

Outline1. What is Circuit Switching?2. What is Packet Switching?3. Why does the Internet use Packet Switching?

Page 3: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Circuit Switching

3

DedicatedWire

DedicatedWire

Page 4: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Circuit Switching

4

DedicatedWire

DedicatedWire

Circuit Switch

Page 5: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 5

Circuit Switching

Source“Caller”

Central Office(C.O.)

Destination“Callee”

Central Office(C.O.)

TrunkExchange

Each phone call allocated 64kb/s. A 10Gb/s trunk line can carry over

150,000 calls.

Page 6: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Circuit Switching- Each call has its own private, guaranteed, isolated

data rate from end-to-end.

- A call has three phases:1. Establish circuit from end-to-end (“dialing”)2. Communicate3. Close circuit (“tear down”)

- Originally, a circuit was an end-to-end physical wire.

- Nowadays, a circuit is like a virtual private wire.

6

Page 7: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Problems1. Inefficient. Computer communication tends to be very

bursty. e.g. typing over an ssh connection, or viewing a sequence of web pages. If each communication has a dedicated circuit, it will be used very inefficiently.

2. Diverse Rates. Computers communicate at many different rates. e.g. a web server streaming video at 6Mb/s, or me typing at 1 character per second. A fixed rate circuit will not be much use.

3. State Management. Circuit switches maintain per-communication state, which must be managed.

7

Page 8: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 8

Outline1. What is Circuit Switching?2. What is Packet Switching?3. Why does the Internet use Packet Switching?

Page 9: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Packet Switching

9

Address Next-hop

B S2

C S3

D S3

AB

Packet Switch

S1

S2

S4

S3

C D

Data HeaderData B

Page 10: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Packet Switching

10

Packet Switch

Page 11: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Packet switches have buffers

11

Data H

Data H

Buffers hold packets:- When two or more packets arrive at the same time- During periods of congestion

Page 12: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 12

Packet SwitchingA

R1

R2

R4

R3

B

Source Destination

-Packets are routed individually, by looking up address in router’s local table.-All packets share the full capacity of a link.- The routers maintain no per-communication state.

H

Page 13: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 13

Outline1. What is Circuit Switching?2. What is Packet Switching?3. Why does the Internet use Packet Switching?

Page 14: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 14

Efficient use of expensive links- Links were assumed to be expensive and scarce. - Packet switching allows many, bursty flows to share the

same link efficiently.- “Circuit switching is rarely used for data networks, ...

because of very inefficient use of the links” – Bertsekas/Gallager

Resilience to failure of links & routers- “For high reliability, ... [the Internet] was to be a datagram

subnet, so if some lines and [routers] were destroyed, messages could be ... rerouted” - Tanenbaum

Page 15: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 15

Summary1. What is Circuit Switching?2. What is Packet Switching?3. Why does the Internet use Packet Switching?

Page 16: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

CS144An Introduction to Computer Networks

Packet SwitchingEnd to End Delay

Nick McKeown Stephen IbanezProfessor of Electrical Engineering and Computer Science, Stanford University

Page 17: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 17

Outline1. Useful definitions2. End-to-end delay3. Queueing delay

Page 18: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 18

Propagation Delay, tl: The time it takes a single bit to travel over a link at propagation speed c.

l

Example: A bit takes 5ms to travel 1,000km in an optical fiber with propagation speed 2 x 108 m/s.

Page 19: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 19

Packetization Delay, tp: The time from when the first to the last bit of a packet is transmitted.

p

Example 1: A 64byte packet takes 5.12μs to be transmitted onto a 100Mb/s link.Example 2: A 1kbit packet takes 1.024s to be transmitted onto a 1kb/s link.

Note: Packetization delay is sometimes called “serialization” delay because it’s the time it takes to serialize a packet onto the link.

r bits/s

Page 20: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 20

Outline1. Useful definitions2. End-to-end delay3. Queueing delay

Page 21: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

End-to-end delay

21

l1, r1 l2, r2

l3, r3 l4, r4

Example: How long will it take a packet of length p to travel from A to B, from when the 1st bit is sent, until the last bit arrives? Assume the switches store-and-forward packets along the path.

A

B

Page 22: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 22

l1, r1 l2, r2 l3, r3 l4, r4A B

S1 S2 S3

A

B

S1

S2

S3

p/r2

l2/c

p/r3

l3/c

p/r4

l4/ctime

l1/c

p/r1 time

Page 23: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 23

l1, r1 l2, r2 l3, r3 l4, r4A B

S1 S2 S3

Other packetsData H

Q2(t)

p/r1A

B

S1

S2

S3

p/r2

l1/c

l2/c

p/r3

p/r4

l3/c

l4/c

Q2(t)

time

*Queueing = UK spelling, adopted by Kleinrock at UCLA in 1960s. Queueing and queuing (US spelling) are both widely used.

Page 24: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Insert the “ping” video here.

24

Page 25: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Packet delay variation

25

CDF (%)

RTT (ms)

Page 26: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Packet delay variation

26

CDF (%)

RTT (ms)

Page 27: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Summary

End to end delay is made up of three main components:- Propagation delay along the links (fixed)- Packetization delay to place packets onto links

(fixed)- Queueing delay in the packet buffers of the

routers (variable)

27

Page 28: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

CS144An Introduction to Computer Networks

Packet SwitchingPlayback Buffers

Nick McKeown Stephen IbanezProfessor of Electrical Engineering and Computer Science, Stanford University

Page 29: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Real-time applications (e.g. YouTube and Skype)

have to cope with variable queueing delay

29

Page 30: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Playback buffers

30From: youtube.com

Playing here

Bufferedto here

Playback buffer

Page 31: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Playback buffers1Mb/s

CumulativeBytes

Time

1Mb/s

Sent b

y Serve

r

Variable delay

Received by Laptop

1Mb/s

Playback rate

Buffer

Server

Page 32: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Playback buffers1Mb/s

Playback point

Videodecoder

Screen

Playback buffer

Server

Page 33: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

If the buffer is too small1Mb/s

CumulativeBytes

Time

1Mb/s

Sent b

y Serve

r

Variable delay

Received by Laptop

Server

1Mb/sBuffer

Make the buffer bigger!

“Rebuffering”

Page 34: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

Playback buffer- With packet switching, end-to-end delay is variable.- We use a playback buffer to absorb the variation.

- We could just make the playback buffer very big, but then the video would be delayed at the start.- Therefore, applications estimate the delay, set the

playback buffer, and resize the buffer if the delay changes.

Page 35: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University 35

l1, r1 l2, r2 l3, r3 l4, r4A B

S1 S2 S3

Other packetsData H

Q2(t)

p/r1A

B

S1

S2

S3

p/r2

l1/c

l2/c

p/r3

p/r4

l3/c

l4/c

Q2(t)

time

Queueing adds variable and unpredictable delay

Page 36: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

SummaryReal-time applications use playback buffers to absorb the variation in queueing delay.

36

Page 37: What is packet switching? CS144 An Introduction to ... · Circuit Switching 3 Dedicated Wire Dedicated Wire. CS144, Stanford University Circuit Switching 4 Dedicated Wire Dedicated

CS144, Stanford University

<End>

37