Top Banner
CS 43: Computer Networks 10: DHTs and CDNs October 3, 2019
53

CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Jun 29, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

CS 43: Computer Networks

10: DHTs and CDNsOctober 3, 2019

Page 2: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Where we are

Application: (So far: HTTP, Email, DNS)Today: P2P systems, Overlay Networks

Transport: end-to-end connections, reliability

Network: routing

Link (data-link): framing, error detection

Physical: 1’s and 0’s/bits across a medium (copper, the air, fiber)

Slide 9

Page 3: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

BitTyrant

• Piatek et al. 2007– Implements the “come in last strategy”– Essentially, an unfair unchoker– Faster than stock BitTorrent (For the Tyrant user)

Slide 10

Page 4: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Hierarchical P2P Networks

• FastTrack network (Kazaa, Grokster, Morpheus, Gnutella++)

supernode

Slide 11

Page 5: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Skype: P2P VoIP

• P2P client supporting VoIP, video, and text based conversation, buddy lists, etc.– Overlay P2P network consisting of ordinary and Super

Nodes (SN)

• Each user registers with a central server– User information propagated in a decentralized fashion

Slide 12

Page 6: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Do the benefits of hierarchical P2P networks out-weight the cons?

A. Pros: ScalabilityB. Pros: Limits floodingC. Cons: No guarantees of performanceD. Cons: Failure?

Slide 13

Page 7: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Overlay Network (P2P)

• A network made up of “virtual” or logical links

• Virtual links map to one or more physical links

Slide 14

Page 8: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Overlay Network (P2P)

• A network made up of “virtual” or logical links

• Virtual links map to one or more physical links

Slide 15

Page 9: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

In our P2P examples with no central server, how would we maintain a mapping of content to nodes?

• Flooding each node and querying • Maintaining an entire list at each node• Some other system that scales

Slide 16

Page 10: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

In our P2P examples with no central server, how would we maintain a mapping of content to nodes?

• Flooding each node and querying • Maintaining an entire list at each node• Some other system that scales (hint: where have we

seen this before?)

Slide 17

Page 11: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Getting rid of that server…

• Distribute the tracker information using a Distributed Hash Table (DHT)

• A DHT is a lookup structure– Maps keys to an arbitrary value.– Works a lot like, well…a hash table.

Slide 18

Page 12: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Recall: Hash Function

• Mapping of any data to an integer– E.g., md5sum, sha1, etc.– md5: 04c3416cadd85971a129dd1de86cee49

• With a good (cryptographic) hash function:– Hash values very likely to be unique– Near-impossible to find collisions (hashes spread out)

Slide 19

Page 13: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Recall: Hash table

• N buckets

• Key-value pair is assigned bucket i– i = HASH(key)%N

• Easy to look up value based on key

• Multiple key-value pairs assigned to each bucket

Slide 20

Page 14: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Distributed Hash Table (DHT)

• DHT: a distributed P2P database

• Distribute the (k, v) pairs across the peers– key: ss number; value: human name– key: file name; value: BT tracker peer(s)

• Same interface as standard HT: (key, value) pairs– get(key) – send key to DHT, get back value– put(key, value) – modify stored value at the given key

Slide 21

Page 15: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Challenges

• How do we assign (key, value) pairs to nodes?

• How do we find them again quickly?

• What happens if nodes join/leave?

• Basic idea: – Convert each key to an integer via hash– Assign integer to each peer via hash– Store (key, value) pair at the peer closest to the key

Slide 22

Page 16: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Simplest form: each peer only aware of immediate successor and predecessor.

Slide 23

Page 17: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Simplest form: each peer only aware of immediate successor and predecessor.

…N

Slide 24

Page 18: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key

Slide 25

Page 19: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key (suppose it gives us 6)

Slide 26

Page 20: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key (suppose it gives us 6)

Slide 27

Page 21: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key (suppose it gives us 6)

Slide 28

Page 22: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key (suppose it gives us 6)

Slide 29

Page 23: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”

– Hash the key (suppose it gives us 6)

If anybody

has it, it’s my

successor.

Slide 30

Page 24: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key (suppose it gives us 6)

Checks key

Slide 31

Page 25: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Circular DHT Overlay

• Example: Node 1 wants key “Led Zeppelin IV”– Hash the key (suppose it gives us 6)

ValueData

Slide 32

Page 26: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Given N nodes, what is the complexity (number of messages) of finding a value when each peer knows its successor?

A. O(log n)

B. O(n)

C. O(n2)

D. O(2n)

1

3

4

5

810

12

15

Can we do better? How?

Slide 33

Page 27: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

1

3

4

5

810

12

15

Reducing Message Count

• Store successors that are 1, 2, 4, 8, …, N/2 away.• Can jump up to half way across the ring at once.• Cut the search space in half - lookups take O(log N) messages.

Slide 34

Page 28: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

More DHT Info

• How do nodes join/leave?• How does cryptographic hashing work?• How much state does each node store?

Slide 35

Page 29: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

More DHT Info

• How do nodes join/leave?• How does cryptographic hashing work?• How much state does each node store?

• Chord: A Scalable Peer-to-Peer Lookup Service for Internet Applications

• Dynamo: Amazon’s Highly Available Key-value Store

Slide 36

Page 30: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

High-Performance Content Distribution

• Problem: You have a service that supplies lots of data. You want good performance for all users!

(often “lots of data” means media files)

Slide 37

Page 31: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

What is a CDN?

• Content Delivery/Distribution Network– At least 70% of the world’s bits are delivered by a

CDN!

Slide 38

Page 32: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

What is a CDN?

• Primary Goals– Create replicas of content throughout the Internet– Ensure that replicas are always available– Directly clients to replicas that will give good

performance

Slide 39

Page 33: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Where do we cache content in a CDN?

A. Client B. ServerC. Internet Service Provider (ISP)

Server

Clients

Backbone ISP

ISP-1 ISP-2

Slide 40

Page 34: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Caching• Why caching works?

– Locality of reference:• Users tend to request the same object in succession• Some objects are popular: requested by many users

Server

Clients

Backbone ISP

ISP-1 ISP-2

Slide 41

Page 35: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

High-Performance Content Distribution

• CDNs applied to all sorts of traffic.– You pay for service (e.g., Akamai), they’ll host your

content very “close” to many users.

Slide 42

Page 36: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

CDN Challenges

• How do we direct the user to a nearby replica instead of the centralized source?

• How do we determine which replica is the best to send them to?

Slide 43

Page 37: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Key Components of a CDN

• Distributed servers– Usually located inside of other ISPs– Often located in IXPs (coming up next)

• High-speed network connecting them• Clients (eyeballs)– Can be located anywhere in the world– They want fast Web performance

• Glue– Something that binds clients to “nearby” replica

servers

Slide 44

Page 38: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Examples of CDNs

• Akamai– 147K+ servers, 1200+ networks, 650+ cities, 92 countries

• Limelight– Well provisioned delivery centers, interconnected via a

private fiber-optic connected to 700+ access networks • Edgecast

– 30+ PoPs, 5 continents, 2000+ direct connections• Others

– Google, Facebook, AWS, AT&T, Level3, Brokers

Slide 45

Page 39: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Finding the CDN

• Three main options:– Application redirect (e.g., HTTP)– “Anycast” routing– DNS resolution (most popular in practice)

• Example: CNN + Akamai

Slide 46

Page 40: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

CNN + Akamai

www.cnn.com

Request: cnn.com/articleResponse: HTML with linkto cache.cnn.com

Content servers: serve content Slide 47

Page 41: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

CNN + Akamai

www.cnn.com

Request: cnn.com/articleResponse: HTML with linkto cache.cnn.com media

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

swarthmore.eduDNS servers

cnn.comDNS servers

pbs.orgDNS servers

Content servers: serve content Slide 48

Page 42: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

CNN + Akamai

www.cnn.com

Request: cnn.com/articleResponse: HTML with linkto cache.cnn.com media

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

swarthmore.eduDNS servers

cnn.comDNS servers

pbs.orgDNS servers

akamai.net DNS servers…

Content servers: serve content

Akamai’s DNS response directs user to selected server.

Retrieve media file.

Slide 49

Page 43: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

CNN + Akamai

www.cnn.com

Request: cnn.com/articleResponse: HTML with linkto cache.cnn.com media

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

swarthmore.eduDNS servers

cnn.comDNS servers

pbs.orgDNS servers

akamai.net DNS servers…

Content servers: serve content

Akamai’s DNS response directs user to selected server.

Retrieve media file.

How to choose?

Slide 50

Page 44: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Which metric is most important when choosing a server? (CDN or otherwise)

A. RTT latency

B. Data transfer rate / throughput

C. Hardware ownership

D. Geographic location

E. Some other metic(s) (such as?)

This is the CDN operator’s secret sauce!

Slide 51

Page 45: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

How well does caching work?

• Very well, up to a point– Large overlap in requested objects– Objects with one access place upper bound on hit

ratio– Dynamic objects not cacheable*

• Example: Wikipedia– About 400 servers, 100 are HTTP Caches – 85% Hit ratio for text, 98% for media

Slide 52

Page 46: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Content in today’s Internet

• Most flows are HTTP

– Web is at least 52% of traffic

– Median object size is 2.7K, average is 85K (as of 2007)

• Is the Internet designed for this common case?

– Why?

Slide 53

Page 47: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Popping up: HTTP performance

• For Web pages – RTT matters most– Where should the server go?

• For video– Available bandwidth matters most– Where should the server go?

• Is there one location that is best for everyone?

Slide 54

Page 48: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Why speed matters

• Impact on user experience– Users navigating away from pages– Video startup delay

• 4x increase in abandonmentwith 10s increase in delay

Slide 55

Page 49: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Streaming Media

• Straightforward approach: simple GET

• Challenges:– Dynamic network characteristics– Varying user device capabilities– User mobility

Slide 56

Page 50: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

HTTP Performance

• What matters for performance?• Depends on type of request– Lots of small requests (objects in a page)– Some big requests (large download or video)

Slide 57

Page 51: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Dynamic Adaptive Streaming over HTTP (DASH)

• Encode several versions of the same media file– low / medium / high / ultra quality

• Break each file into chunks

• Create a “manifest” to map file versions to chunks / video time offset

Slide 58

Page 52: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Dynamic Adaptive Streaming over HTTP (DASH)

• Client requests manifest file, chooses version

• Requests new chunks as it plays existing ones

• Can switch between versions at any time!

Slide 59

Page 53: CS 43: Computer Networkschaganti/cs43/f19/lecs/10-DHT-CD… · Skype: P2P VoIP •P2P client supporting VoIP, video, and text based conversation, buddy lists, etc. –Overlay P2P

Summary

• Decentralized lookup: DHTs

• CDNs: locating “good” replica for content servers

• DASH: streaming despite dynamic conditions

Slide 60