Assignments LECTURE 6 Lab 2 Content Distribution Networks,

11
1 Computer Networks LECTURE 6 Content Distribution Networks, Network Control Plane Sandhya Dwarkadas Department of Computer Science University of Rochester Assignments Lab 2 DUE TODAY Project 1: Web Proxy Server DUE OCT 3 Network Applications and Application Layer Protocols Application Layer 2-4 Some network apps e-mail web text messaging remote login P2P file sharing multi-user network games streaming stored video (YouTube, Hulu, Netflix) voice over IP (e.g., Skype) real-time video conferencing social networking search

Transcript of Assignments LECTURE 6 Lab 2 Content Distribution Networks,

Page 1: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

1

Computer Networks

LECTURE 6

Content Distribution Networks,

Network Control Plane

Sandhya Dwarkadas

Department of Computer Science

University of Rochester

Assignments

• Lab 2

– DUE TODAY

• Project 1: Web Proxy Server

– DUE OCT 3

Network Applications and

Application Layer Protocols

Application Layer 2-4

Some network apps

• e-mail

• web

• text messaging

• remote login

• P2P file sharing

• multi-user network

games

• streaming stored video

(YouTube, Hulu,

Netflix)

• voice over IP (e.g.,

Skype)

• real-time video

conferencing

• social networking

• search

• …

• …

Page 2: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

2

PEER-TO-PEER APPLICATIONS

Application Layer 2-6

Pure P2P architecture

no always-on server

arbitrary end systems directly communicate

peers are intermittently connected and change IP addresses

examples:• file distribution

(BitTorrent)

• Streaming (KanKan)

• VoIP (Skype)

Application Layer 2-7

File distribution: client-server vs P2P

Question: how much time to distribute file (size F) from one server to N peers?• peer upload/download capacity is limited resource

us

uN

dN

server

network (with abundant

bandwidth)

file, size F

us: server upload capacity

ui: peer i upload capacity

di: peer i download capacityu2 d2

u1 d1

di

ui

Application Layer 2-8

File distribution time: client-server

server transmission: mustsequentially send (upload) N file copies:

• time to send one copy: F/us

• time to send N copies: NF/us

increases linearly in N

time to distribute F

to N clients using

client-server approachDc-s > max{NF/us,,F/dmin}

client: each client must download file copy• dmin = min client download rate

• min client download time: F/dmin

us

network

di

ui

F

Page 3: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

3

Application Layer 2-9

File distribution time: P2P

server transmission: mustupload at least one copy

• time to send one copy: F/us

time to distribute F

to N clients using

P2P approach

us

network

di

ui

F

DP2P > max{F/us,,F/dmin,,NF/(us + Sui)}

client: each client must download file copy• min client download time: F/dmin

clients: as aggregate must download NF bits

• max upload rate (limiting max download rate) is us + Sui

… but so does this, as each peer brings service capacity

increases linearly in N …

Application Layer 2-10

0

0.5

1

1.5

2

2.5

3

3.5

0 5 10 15 20 25 30 35

N

Min

imum

Dis

trib

ution T

ime P2P

Client-Server

Client-server vs. P2P: example

client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us

Application Layer 2-11

P2P file distribution: BitTorrent

tracker: tracks peers participating in torrent

torrent: group of peers exchanging chunks of a file

Alice arrives …

file divided into 256Kb chunks

peers in torrent send/receive file chunks

… obtains list

of peers from tracker

… and begins exchanging

file chunks with peers in torrent

Application Layer 2-12

peer joining torrent:

• has no chunks, but will accumulate them over time from other peers

• registers with tracker to get list of peers, connects to subset of peers (“neighbors”)

P2P file distribution: BitTorrent

while downloading, peer uploads chunks to other peers

peer may change peers with whom it exchanges chunks

churn: peers may come and go

once peer has entire file, it may (selfishly) leave or (altruistically) remain in torrent

Page 4: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

4

Application Layer 2-13

BitTorrent: requesting, sending file chunks

requesting chunks: at any given time, different

peers have different subsets of file chunks

periodically, Alice asks each peer for list of chunks that they have

Alice requests missing chunks from peers, rarest first

sending chunks: tit-for-tat Alice sends chunks to those

four peers currently sending her chunks at highest rate• other peers are choked by Alice

(do not receive chunks from her)

• re-evaluate top 4 every10 secs

every 30 secs: randomly select another peer, starts sending chunks• “optimistically unchoke” this peer

• newly chosen peer may join top 4

Application Layer 2-14

BitTorrent: tit-for-tat

(1) Alice “optimistically unchokes” Bob

(2) Alice becomes one of Bob’s top-four providers; Bob reciprocates

(3) Bob becomes one of Alice’s top-four providers

higher upload rate: find better

trading partners, get file faster !

CONTENT DISTRIBUTION

NETWORKS AND STREAMING

MEDIAApplication Layer 2-16

Video Streaming and CDNs: context

• Netflix, YouTube: 37%, 16% of downstream

residential ISP traffic

• ~1B YouTube users, ~75M Netflix users

challenge: scale - how to reach ~1B

users?

• single mega-video server won’t work (why?)

challenge: heterogeneity

different users have different capabilities (e.g.,

wired versus mobile; bandwidth rich versus

bandwidth poor)

solution: distributed, application-level

infrastructure

video traffic: major consumer of Internet bandwidth

Page 5: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

5

video: sequence of images displayed at constant rate

• e.g., 24 images/sec

digital image: array of pixels

• each pixel represented by bits

coding: use redundancy within and between images to decrease # bits used to encode image

• spatial (within image)

• temporal (from one image to next)

Multimedia: video

……………………..

spatial coding example: instead

of sending N values of same

color (all purple), send only two

values: color value (purple) and

number of repeated values (N)

……………….…….

frame i

frame i+1

temporal coding example:

instead of sending

complete frame at i+1,

send only differences from

frame i

Application Layer 2-17

Multimedia: video CBR: (constant bit rate):

video encoding rate fixed

VBR: (variable bit rate): video encoding rate changes as amount of spatial, temporal coding changes

examples:

• MPEG 1 (CD-ROM) 1.5

Mbps

• MPEG2 (DVD) 3-6 Mbps

• MPEG4 (often used in

Internet, < 1 Mbps)

……………………..

spatial coding example: instead

of sending N values of same

color (all purple), send only two

values: color value (purple) and

number of repeated values (N)

……………….…….

frame i

frame i+1

temporal coding example:

instead of sending

complete frame at i+1,

send only differences from

frame i

Application Layer 2-18

Streaming stored video:

simple scenario:

video server

(stored video)client

Internet

Application Layer 2-19

Streaming multimedia: DASH

DASH: Dynamic, Adaptive Streaming over HTTP

server:• divides video file into multiple chunks

• each chunk stored, encoded at different rates

• manifest file: provides URLs for different chunks

client:• periodically measures server-to-client bandwidth

• consulting manifest, requests one chunk at a time

• chooses maximum coding rate sustainable given

current bandwidth

• can choose different coding rates at different points

in time (depending on available bandwidth at time)

Application Layer 2-20

Page 6: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

6

Streaming multimedia: DASH

DASH: Dynamic, Adaptive Streaming over HTTP

“intelligence” at client: client determines• when to request chunk (so that buffer starvation, or

overflow does not occur)

• what encoding rate to request (higher quality when more bandwidth available)

• where to request chunk (can request from URL server that is “close” to client or has high available bandwidth)

Application Layer 2-21

Content distribution networks

challenge: how to stream content (selected from millions of videos) to hundreds of thousands of simultaneous users?

option 1: single, large “mega-server”• single point of failure

• point of network congestion

• long path to distant clients

• multiple copies of video sent over outgoing link

….quite simply: this solution doesn’t scale

Application Layer 2-22

Content distribution networks

challenge: how to stream content (selected from millions of videos) to hundreds of thousands of simultaneous users?

option 2: store/serve multiple copies of videos at multiple geographically distributed sites (CDN)• enter deep: push CDN servers deep into many access

networks • close to users

• used by Akamai, 1700 locations

• bring home: smaller number (10’s) of larger clusters in POPs near (but not within) access networks

• used by Limelight

Application Layer 2-23

Content Distribution Networks (CDNs)

subscriber requests content from CDN

CDN: stores copies of content at CDN nodes • e.g. Netflix stores copies of MadMen

where’s Madmen?

manifest file

• directed to nearby copy, retrieves content• may choose different copy if network path congested

Application Layer 2-24

Page 7: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

7

Content Distribution Networks (CDNs)

Internet host-host communication as a service

OTT challenges: coping with a congested Internet from which CDN node to retrieve content?

viewer behavior in presence of congestion?

what content to place in which CDN node?

“over the top”

more .. in chapter 7

CDN content access: a closer look

Bob (client) requests video http://netcinema.com/6Y7B23V

video stored in CDN at http://KingCDN.com/NetC6y&B23V

netcinema.com

KingCDN.com

1

1. Bob gets URL for video

http://video.netcinema.com/6Y7B23V

from netcinema.com web page

2

2. resolve http://video.netcinema.com/6Y7B23V

via Bob’s local DNS

netcinema’sauthoratative DNS

3

3. netcinema’s DNS returns URL

http://KingCDN.com/NetC6y&B23V 44&5. Resolve

http://KingCDN.com/NetC6y&B23

via KingCDN’s authoritative DNS,

which returns IP address of KingCDN

server with video

56. request video from

KINGCDN server,

streamed via HTTP

KingCDNauthoritative DNS

Bob’s local DNSserver

Application Layer 2-26

Case study: Netflix

1

1. Bob manages

Netflix account

Netflix registration,accounting servers

Amazon cloud

CDN

server

2

2. Bob browses

Netflix video3

3. Manifest file

returned for

requested video

4. DASH

streaming

upload copies of multiple versions of video to CDN servers

CDN

server

CDN

server

Application Layer 2-27

NETWORK LAYER

Page 8: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

8

Internet Architecture

Bottom-up:• physical: electromagnetic signals “on the wire”

• link: data transfer between neighboring network elements

– encoding, framing, error correction, access control for shared links

• network: host-to-host connectivity– routing, addressing

• transport: host-host data transport– reliable data transport, congestion control, flow

control

• application: anything you want to do on computer networks

application

transport

network

link

physical

9/21/2016 CSC 257/457 - Fall 2014 29

Network Layer Function

• transport packet from sending to receiving hosts

– routing: determine a path from source to dest and route packets along the path

– addressing: uniquely identify each node in the network

• network connecting devices

– called “routers”

– participate in network protocols

• links

– connect adjacent hosts, routers

9/21/2016 CSC 257/457 - Fall 2014 30

Protocol Layers and Data Flows

applicationtransportnetwork

linkphysical

applicationtransportnetwork

linkphysical

applicationtransportnetwork

linkphysical

applicationtransportnetwork

linkphysical

networklink

physical

data

data

9/21/2016 CSC 257/457 - Fall 2014 31

Data Formation Across Layers

Each layer takes data from above

• adds header information to create new data unit

• passes new data unit to layer below

applicationtransportnetwork

linkphysical

applicationtransportnetwork

linkphysical

source destination

M

M

M

M

Ht

HtHn

HtHnHl

M

M

M

M

Ht

HtHn

HtHnHl

message

segment

packet

frame

9/21/2016 32

Page 9: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

9

Network Service Model

• loss-free delivery?

• in-order delivery?

• preservation of inter-packet delay (no jitter)?

• guaranteed bandwidth?

• congestion feedback to sender?

connection-based or packet switching?

9/21/2016 33

Connection-based Networks

• guaranteed bandwidth, jitter-free, in-order delivery build on the concept of connections, or virtual circuits

• require signaling protocols to setup, maintain, and teardown virtual circuit

• router maintains state about ongoing connections

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Initiate call 2. incoming call

3. Accept call4. Call connected5. Data flow begins 6. Receive data

Efficiency?

9/21/2016 34

Packet Switching

• no connection every packet is on its own

• stateless routers no need to remember anything about packets

• packets forwarded independently from each other

– packets between same source-dest pair may take different paths

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send data 2. Receive data

9/21/2016 35

Packet Switching vs. Connection-based Networks

Packet switching• poor service guarantee

– “elastic” service

• efficiency

• scalability

• robustness

• flexibility/customization– simple network core, complexity

at “edge”

manage, control, adapt at “smart” end systems (computers)

Connection-based• evolved from telephony

• guaranteed service– e.g., human conversation:

– strict timing, reliability requirements

• hard to evolve– complex network core

Internet employs packet switching; connection-based are more suitable for networks with deterministic traffic.

9/21/2016 36

Page 10: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

10

Routing Principles

Graph abstraction for routing algorithms:

• graph nodes are hosts or routers

• graph edges are links

– link cost: delay, $ cost, or congestion level

Goal: determine “good” path(sequence of routers) thru

network from source to dest.

Routing protocol

A

ED

CB

F

2

2

13

1

1

2

53

5

“good” path:

typically means minimum cost path

9/21/2016 37

Routing Algorithm Classification

Global information:

• all routers have complete topology, link cost info

• “link state” algorithm

Decentralized:

• router knows connected neighbors, link costs to neighbors

• exchange of info with neighbors to learn remote parts of the network, may take many learning rounds

• “distance vector” algorithm

9/21/2016 38

A link-state routing algorithm

Dijkstra’s algorithm net topology, link costs

known to all nodes• accomplished via “link state

broadcast”• all nodes have same info

computes least cost paths from one node (‘source”) to all other nodes• gives forwarding table for

that node

iterative: after k iterations, know least cost path to k dest.’s

notation: c(x,y): link cost from

node x to y; = ∞ if not direct neighbors

D(v): current value of cost of path from source to dest. v

p(v): predecessor node along path from source to v

N': set of nodes whose least cost path definitively known

5-39Network Layer: Control Plane

Dijsktra’s algorithm

1 Initialization:

2 N' = {u}

3 for all nodes v

4 if v adjacent to u

5 then D(v) = c(u,v)

6 else D(v) = ∞

7

8 Loop

9 find w not in N' such that D(w) is a minimum

10 add w to N'

11 update D(v) for all v adjacent to w and not in N' :

12 D(v) = min( D(v), D(w) + c(w,v) )

13 /* new cost to v is either old cost to v or known

14 shortest path cost to w plus cost from w to v */

15 until all nodes in N'

5-40Network Layer: Control Plane

Page 11: Assignments LECTURE 6 Lab 2 Content Distribution Networks,

11

w3

4

v

x

u

5

37 4

y

8

z2

7

9

Dijkstra’s algorithm: example

Step N'D(v)

p(v)

0

1

2

3

4

5

D(w)p(w)

D(x)p(x)

D(y)p(y)

D(z)p(z)

u ∞ ∞ 7,u 3,u 5,u

uw ∞ 11,w6,w 5,u

14,x 11,w 6,wuwx

uwxv 14,x 10,v

uwxvy 12,y

notes: construct shortest path tree by

tracing predecessor nodes

ties can exist (can be broken arbitrarily)

uwxvyz

5-41Network Layer: Control Plane

Dijkstra’s algorithm: another example

Step

0

1

2

3

4

5

N'

u

ux

uxy

uxyv

uxyvw

uxyvwz

D(v),p(v)

2,u

2,u

2,u

D(w),p(w)

5,u

4,x

3,y

3,y

D(x),p(x)

1,u

D(y),p(y)∞

2,x

D(z),p(z)∞ ∞

4,y

4,y

4,y

u

yx

wv

z

2

2

13

1

1

2

53

5

5-42Network Layer: Control Plane

* Check out the online interactive exercises for more

examples: http://gaia.cs.umass.edu/kurose_ross/interactive/

Dijkstra’s algorithm: example (2)

u

yx

wv

z

resulting shortest-path tree from u:

v

x

y

w

z

(u,v)

(u,x)

(u,x)

(u,x)

(u,x)

destination link

resulting forwarding table in u:

5-43Network Layer: Control Plane

Disclaimer

• Parts of the lecture slides are adapted from

and copyrighted by James Kurose and Keith

Ross and from those by Prof. Kai Shen. The

slides are intended for the sole purpose of

instruction of computer networks at the

University of Rochester. All copyrighted

materials belong to their original owner(s).