EECS 122 Introduction to Computer Networks CDNs and

  • Slides: 68
Download presentation
EECS 122: Introduction to Computer Networks CDNs and Peer-to-Peer Computer Science Division Department of

EECS 122: Introduction to Computer Networks CDNs and Peer-to-Peer Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley, CA 94720 -1776 EECS 122 - UCB Katz, Stoica F 04

Today’s Lecture: 18 17, 18, 19 2 6 Transport 10, 11 14, 15, 16

Today’s Lecture: 18 17, 18, 19 2 6 Transport 10, 11 14, 15, 16 7, 8, 9 21, 22, 23 25 Application Network (IP) Link Physical 2/28/2021 Katz, Stoica F 04 2

This Lecture § This will be a “why” lecture, not a “how to” one

This Lecture § This will be a “why” lecture, not a “how to” one § Emphasis is on why these developments are important, and where the fit into the broader picture § TAs will fill in the technical details 2/28/2021 Katz, Stoica F 04 3

Outline § Motivation: information sharing - what’s the role of peer-to-peer (P 2 P)?

Outline § Motivation: information sharing - what’s the role of peer-to-peer (P 2 P)? § Centralized P 2 P networks - Napster § Decentralized but unstructured P 2 P networks - Gnutella § Decentralized but structured P 2 P networks - Distributed Hash Tables Implications for the Internet (speculative) 2/28/2021 § Katz, Stoica F 04 4

Information Sharing in the Internet § The Internet contains a vast collection of information

Information Sharing in the Internet § The Internet contains a vast collection of information (documents, web pages, media, etc. ) § One goal of the Internet is to make it easy to share this information § There are many different ways this can be done. . . 2/28/2021 Katz, Stoica F 04 5

In the beginning. . . § . . . there was FTP § People

In the beginning. . . § . . . there was FTP § People put files on a server and allowed anonymous FTP - does anyone here remember anonymous FTP? § Only people who were explicitly told about the file would know to retrieve it § But it was a painful, command-line interface 2/28/2021 Katz, Stoica F 04 6

The Early Web § The early web was essentially a GUI for anon ftp

The Early Web § The early web was essentially a GUI for anon ftp - URLs were easily distributed pointers to files - Browsers allowed one to easily retrieve files § Web pages could contain pointers to other files - not all downloads were result of being explicitly told § But information sharing was still mostly explicitly arranged - someone sent you a URL - and you bookmarked it 2/28/2021 Katz, Stoica F 04 7

The Current Web § Search engines changed the web - long before your time.

The Current Web § Search engines changed the web - long before your time. . § Now one can proactively find the desired information, not just wait for someone to tell you about it § In the process, it became less important who was hosting the information (because they don’t need to tell you) - the nature of the content is all that matters now 2/28/2021 Katz, Stoica F 04 8

Two Transitions § From push to pull: - old: people would tell others about

Two Transitions § From push to pull: - old: people would tell others about information (push) - new: people can find information via google (pull) § From hosts to servers - § anonymous ftp could run on anyone’s desktop then migrated to specialized servers the web almost exclusively uses servers popular sites have to use big server farms What about “pull” with “hosts”? - that’s peer-to-peer networking! 2/28/2021 Katz, Stoica F 04 9

Why Is Pull/Host Relevant? § There are many pieces of content that: - are

Why Is Pull/Host Relevant? § There are many pieces of content that: - are already widely replicated on many machines - people want, but don’t know where it is § Setting up a web site for all such content would: - attract huge amount of traffic - require sizable investment in server farm and bandwidth § If we could harness the hosts that already have the content, we wouldn’t need a server farm! § But how do users know which host to contact? 2/28/2021 Katz, Stoica F 04 10

Peer-to-Peer (P 2 P) Networking § Aims to use the bandwidth and storage of

Peer-to-Peer (P 2 P) Networking § Aims to use the bandwidth and storage of the many hosts - sum of access line speeds and disk space § But to use this collection of machines effectively requires coordination on a massive scale - key challenge: who has the content you are looking for? § Moreover, the hosts are very flaky - behind slow links - often connected only a few minutes - so system must be very robust 2/28/2021 Katz, Stoica F 04 11

Napster § Centralized search engine: - § all hosts with songs register them with

Napster § Centralized search engine: - § all hosts with songs register them with central site users do keyword search on site to find desired song site then lists the hosts that have the song user then downloads content What makes this work? - central site only has to handle searches: little bandwidth - vast collection of hosts can supply huge aggregate bandwidth - system is self-scaling: more users means more resources 2/28/2021 Katz, Stoica F 04 12

What Happened to Napster? § Fastest growing Internet application ever - P 2 P

What Happened to Napster? § Fastest growing Internet application ever - P 2 P traffic became, and remains, one of the biggest sources of traffic on the Internet! § But legal issues shut site down § Centralized system was vulnerable to legal attacks, and system couldn’t function without central site § Can one still do “pull” without central site? 2/28/2021 - that’s the hard question in peer-to-peer networking! Katz, Stoica F 04 13

Gnutella § An example of an unstructured, decentralized P 2 P system § Context:

Gnutella § An example of an unstructured, decentralized P 2 P system § Context: - many hosts join a system - each offers to share its own content - in return, each can make queries for others content § Goal: - enable users to find desired content on other hosts 2/28/2021 Katz, Stoica F 04 14

“Basic” Gnutella § Step one: form an overlay network - each host, when it

“Basic” Gnutella § Step one: form an overlay network - each host, when it joins, “connects” to several existing Gnutella members - an “overlay” link is merely the fact that the nodes know each other’s IP address, and thus can send each other packets 2/28/2021 Katz, Stoica F 04 15

“Unstructured” Overlay Gnutella is unstructured in two senses: § Links between nodes are essentially

“Unstructured” Overlay Gnutella is unstructured in two senses: § Links between nodes are essentially random § The content of each node is random (at least from the perspective of Gnutella) Implications: § Can’t route on Gnutella § Wouldn’t know where to route even if could 2/28/2021 Katz, Stoica F 04 16

Querying in Gnutella § Queries are typically keyword searches § Each query is flooded

Querying in Gnutella § Queries are typically keyword searches § Each query is flooded within some scope - TTL is used to limit scope of flood - flooding means you don’t need any routing infrastructure § All responses to queries are forwarded back along path query came from - path marked with breadcrumbs - gives a degree of privacy to requester 2/28/2021 Katz, Stoica F 04 17

Gnutella Performance § Tradeoff: - if TTL is small, then searches won’t find desired

Gnutella Performance § Tradeoff: - if TTL is small, then searches won’t find desired content - if TTL is large, network will get overloaded § Either Gnutella overloads network, or doesn’t provide good search results 2/28/2021 Katz, Stoica F 04 18

Gnutella Enhancements § Supernodes: - normal nodes attach to supernodes, who search for them

Gnutella Enhancements § Supernodes: - normal nodes attach to supernodes, who search for them - only flood among well-connected supernodes § Random-walk rather than flooding - provides correct TTL automatically § Proactive replication - replicate content that is frequently queried, to make it easier to find 2/28/2021 Katz, Stoica F 04 19

In Reality § Gnutella++ works well enough - Ka. Za. A, etc. § Why?

In Reality § Gnutella++ works well enough - Ka. Za. A, etc. § Why? - enhancements (supernodes) - query distribution § Most downloads are for widely-replicated content - Gnutella is good at finding the “hay” - But how would you find “needles”? 2/28/2021 Katz, Stoica F 04 20

Finding Objects by Name § Assume you know the “name” of an object -

Finding Objects by Name § Assume you know the “name” of an object - song title, file name, etc. § Assume that there is one copy of this object in the system § Is there a way to store this object so that anyone can find it merely by knowing its name? § Sound familiar? Hash tables 2/28/2021 Katz, Stoica F 04 21

Distributed Hash Tables (DHTs) § Hash Table - data structure that maps “keys” to

Distributed Hash Tables (DHTs) § Hash Table - data structure that maps “keys” to “values” - essential building block in software systems § Distributed Hash Table (DHT) - similar, but spread across the Internet § Interface - insert(key, value) - lookup(key) 2/28/2021 Katz, Stoica F 04 22

Usage § key = hash(name) - hash function is a deterministic function that is

Usage § key = hash(name) - hash function is a deterministic function that is quasirandom - gives uniform distribution of keys § Store by key § Retrieve by key 2/28/2021 Katz, Stoica F 04 23

DHT: basic idea K V K V K V 2/28/2021 Katz, Stoica F 04

DHT: basic idea K V K V K V 2/28/2021 Katz, Stoica F 04 24

DHT: basic idea K V K V K V 2/28/2021 Katz, Stoica F 04

DHT: basic idea K V K V K V 2/28/2021 Katz, Stoica F 04 25

DHT: basic idea K V K V K V 2/28/2021 Operation: take key as

DHT: basic idea K V K V K V 2/28/2021 Operation: take key as input; route messages to node holding key Katz, Stoica F 04 26

DHT: basic idea K V K V K V insert(K 1, V 1) K

DHT: basic idea K V K V K V insert(K 1, V 1) K V 2/28/2021 Operation: take key as input; route messages to node holding key Katz, Stoica F 04 27

DHT: basic idea K V K V K V insert(K 1, V 1) K

DHT: basic idea K V K V K V insert(K 1, V 1) K V 2/28/2021 Operation: take key as input; route messages to node holding key Katz, Stoica F 04 28

DHT: basic idea (K 1, V 1) K V K V K V 2/28/2021

DHT: basic idea (K 1, V 1) K V K V K V 2/28/2021 Operation: take key as input; route messages to node holding key Katz, Stoica F 04 29

DHT: basic idea K V K V K V retrieve (K 1) 2/28/2021 Operation:

DHT: basic idea K V K V K V retrieve (K 1) 2/28/2021 Operation: take key as input; route messages to node holding key Katz, Stoica F 04 30

DHT Designs § There are many DHT designs - invented in 2000, so they

DHT Designs § There are many DHT designs - invented in 2000, so they are quite new § I will present CAN, readings present others - details will be gone over by your TAs § But don’t worry about the details, focus on the general idea § In what follows, id or identifier is a key 2/28/2021 Katz, Stoica F 04 31

General Approach to DHT Routing § Pick an identifier space - ring, tree, hypercube,

General Approach to DHT Routing § Pick an identifier space - ring, tree, hypercube, d-dimensional torus, etc. § Assign node ids randomly in space - choose a “structured” set of neighbors § Assign objects ids (keys) randomly via hash function in space - Assign an object to node that is “closest” to it § When routing to an id, pick neighbor which is closest to id - if neighbor set is wisely chosen, routing will be efficient 2/28/2021 Katz, Stoica F 04 32

Content Addressable Network (CAN) § § Associate to each node and item a unique

Content Addressable Network (CAN) § § Associate to each node and item a unique id in an d-dimensional space Properties - Routing table size O(d) - Guarantees that a file is found in at most d*n 1/d steps, where n is the total number of nodes 2/28/2021 Katz, Stoica F 04 33

CAN Example: Two Dimensional Space § § Space divided between nodes All nodes cover

CAN Example: Two Dimensional Space § § Space divided between nodes All nodes cover the entire space Each node covers either a square or a rectangular area of ratios 1: 2 or 2: 1 Example: 7 6 - Assume space size (8 x 8) 5 - Node n 1: (1, 2) first node that joins cover the entire space 4 3 n 1 2 1 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 34 7

CAN Example: Two Dimensional Space § Node n 2: (4, 2) joins space is

CAN Example: Two Dimensional Space § Node n 2: (4, 2) joins space is divided between n 1 and n 2 7 6 5 4 3 n 2 n 1 2 1 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 35 7

CAN Example: Two Dimensional Space § Node n 2: (4, 2) joins space is

CAN Example: Two Dimensional Space § Node n 2: (4, 2) joins space is divided between n 1 and n 2 7 6 n 3 5 4 3 n 2 n 1 2 1 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 36 7

CAN Example: Two Dimensional Space § Nodes n 4: (5, 5) and n 5:

CAN Example: Two Dimensional Space § Nodes n 4: (5, 5) and n 5: (6, 6) join 7 6 n 5 n 4 n 3 5 4 3 n 2 n 1 2 1 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 37 7

CAN Example: Two Dimensional Space § § Nodes: n 1: (1, 2); n 2:

CAN Example: Two Dimensional Space § § Nodes: n 1: (1, 2); n 2: (4, 2); n 3: (3, 5); n 4: (5, 5); n 5: (6, 6) Items: f 1: (2, 3); f 2: (5, 1); f 3: (2, 1); f 4: (7, 5); 7 6 n 5 n 4 n 3 5 f 4 4 f 1 3 n 2 n 1 2 f 3 1 f 2 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 38 7

CAN Example: Two Dimensional Space § Each item is stored by the node who

CAN Example: Two Dimensional Space § Each item is stored by the node who owns its mapping in the space 7 6 n 5 n 4 n 3 5 f 4 4 f 1 3 n 2 n 1 2 f 3 1 f 2 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 39 7

CAN: Query Example § § § Each node knows its neighbors in the dspace

CAN: Query Example § § § Each node knows its neighbors in the dspace Forward query to the neighbor that is closest to the query id Example: assume n 1 queries f 4 7 6 n 5 n 4 n 3 5 f 4 4 f 1 3 n 2 n 1 2 f 3 1 f 2 0 0 1 2 3 4 5 6 2/28/2021 Katz, Stoica F 04 40 7

Many Other DHT Designs § Chord: - id space is circle - routing table

Many Other DHT Designs § Chord: - id space is circle - routing table includes predecessor node and nodes 2 -i away - routing always halves distance § Pastry and Tapestry - id space is tree - routing table includes neighboring subtree of varying heights - routing always fixes at least one bit on each step 2/28/2021 Katz, Stoica F 04 41

Chord Routing Table 1/4 1/2 1/8 1/16 1/32 1/64 1/128 2/28/2021 Katz, Stoica F

Chord Routing Table 1/4 1/2 1/8 1/16 1/32 1/64 1/128 2/28/2021 Katz, Stoica F 04 42

Performance § Routing in the overlay network can be more expensive than in the

Performance § Routing in the overlay network can be more expensive than in the underlying network § Because usually there is no correlation between node ids and their locality; a query can repeatedly jump from Europe to North America, though both the initiator and the node that store the item are in Europe! § Solution: make neighbor relationships depend on link latency - Can achieve “stretch” of ~1. 3 2/28/2021 Katz, Stoica F 04 43

Other Issues § Data replication § Security § Resilience to failures, node churn §

Other Issues § Data replication § Security § Resilience to failures, node churn § Monitoring § . . . 2/28/2021 Katz, Stoica F 04 44

General DHT Properties § Fully decentralized: all nodes equivalent § Self-organizing: no need to

General DHT Properties § Fully decentralized: all nodes equivalent § Self-organizing: no need to explicitly arrange routing, algorithm does it automatically § Robust: can tolerate node failures § Scalable: can grow to immense sizes § Flat namespace: does not impose semantics - as opposed to DNS 2/28/2021 Katz, Stoica F 04 45

Structured vs Unstructured § Unstructured: - can tolerate churn - can find hay -

Structured vs Unstructured § Unstructured: - can tolerate churn - can find hay - can do searches easily § Structured: - designed for needles have trouble with keyword searches have some trouble with extreme churn have different sharing model 2/28/2021 Katz, Stoica F 04 46

Other Design Options § Centralized? - single point-of-failure - requires infrastructure to scale (business

Other Design Options § Centralized? - single point-of-failure - requires infrastructure to scale (business model) § Hierarchical? - requires given hierarchical organization - static hierarchy of servers: not robust or flexible - dynamic hierarchy of servers: essentially a DHT 2/28/2021 Katz, Stoica F 04 47

Are DHTs Just for File Sharing? § Think of DHTs as a new DNS

Are DHTs Just for File Sharing? § Think of DHTs as a new DNS - mapping names to identifiers - identifiers are persistent and general § A web based with persistent pointers, not ephemeral URLs § Overlay networks based on persistent keys, not changeable IP addresses - send to identifier, translated into current IP address 2/28/2021 Katz, Stoica F 04 48

More Generally § Hash tables are useful data structures for many programs § Distributed

More Generally § Hash tables are useful data structures for many programs § Distributed hash tables should be generally useful data structures for distributed programs § Examples: file systems, event notification, application-layer multicast, mail systems, . . 2/28/2021 Katz, Stoica F 04 49

Indexing A ♫♫♫ HASH(xyz. mp 3) 2/28/2021 = K 1 Katz, Stoica F 04

Indexing A ♫♫♫ HASH(xyz. mp 3) 2/28/2021 = K 1 Katz, Stoica F 04 50

Indexing K 1 (xyz. mp 3, A) insert A ♫♫♫ HASH(xyz. mp 3) 2/28/2021

Indexing K 1 (xyz. mp 3, A) insert A ♫♫♫ HASH(xyz. mp 3) 2/28/2021 = K 1 Katz, Stoica F 04 51

Indexing K 1 (xyz. mp 3, A) A 2/28/2021 ♫♫♫ lookup B HASH(xyz. mp

Indexing K 1 (xyz. mp 3, A) A 2/28/2021 ♫♫♫ lookup B HASH(xyz. mp 3) = K 1 Katz, Stoica F 04 52

Indexing K 1 (xyz. mp 3, A) A xyz B 2/28/2021 Katz, Stoica F

Indexing K 1 (xyz. mp 3, A) A xyz B 2/28/2021 Katz, Stoica F 04 53

Indexing K 1 (xyz. mp 3, A) A 2/28/2021 ♫♫♫ B 54 content could

Indexing K 1 (xyz. mp 3, A) A 2/28/2021 ♫♫♫ B 54 content could as easily have been a web page, disk block, data object, DNS name, … Katz, Stoica F 04

Anycast Communication C B insert K 1 (xyz. mp 3, A) (xyz. mp 3,

Anycast Communication C B insert K 1 (xyz. mp 3, A) (xyz. mp 3, B) (xyz. mp 3, C) A 2/28/2021 Katz, Stoica F 04 55

Anycast Communication C B K 1 (xyz. mp 3, A) (xyz. mp 3, B)

Anycast Communication C B K 1 (xyz. mp 3, A) (xyz. mp 3, B) (xyz. mp 3, C) (xyz. mp 3, A) A 2/28/2021 “anycast” lookup; based on a number of metrics Katz, Stoica F 04 56

Database Join on $-value (abc, 35$) (A, 20$) (A, 35$) (xyz, 20$) 2/28/2021 Katz,

Database Join on $-value (abc, 35$) (A, 20$) (A, 35$) (xyz, 20$) 2/28/2021 Katz, Stoica F 04 57

Database Join on $-value = K 1 HASH(35$) = K 2 HASH(20$) (A, 35$)

Database Join on $-value = K 1 HASH(35$) = K 2 HASH(20$) (A, 35$) K 1 (abc, 35$) K 2 (xyz, 20$) 2/28/2021 Katz, Stoica F 04 58

Database Join on $-value = K 1 HASH(35$) = K 2 HASH(20$) (A, 35$)

Database Join on $-value = K 1 HASH(35$) = K 2 HASH(20$) (A, 35$) K 1 (abc, 35$) K 2 (xyz, 20$) 2/28/2021 Katz, Stoica F 04 59

Database Join on $-value = K 1 HASH(35$) = K 2 HASH(20$) (A, 35$)

Database Join on $-value = K 1 HASH(35$) = K 2 HASH(20$) (A, 35$) K 1 (20$, A, xyz) (abc, 35$) K 2 (35$, A, abc) (xyz, 20$) Massively parallel, distributed join on Internet scales! 2/28/2021 Katz, Stoica F 04 60

DHTs: Key Insight § Many uses for DHTs - § Indexing Multicast, anycast Database

DHTs: Key Insight § Many uses for DHTs - § Indexing Multicast, anycast Database joins, sort, range search Service composition Event notification … DHT namespace essentially provides a level of indirection - “Any computer systems problem can be solved by adding a level of indirection” § How is indirection done today? 2/28/2021 Katz, Stoica F 04 61

Indirection today Chat Blogs Web (Client/Server) Applications Hierarchical name and service structure DNS Indirection

Indirection today Chat Blogs Web (Client/Server) Applications Hierarchical name and service structure DNS Indirection services (by hostname) IP Connectivity 2/28/2021 Katz, Stoica F 04 62

Indirection today Chat Blogs Web (Client/Server) Applications Hierarchical name and service structure Google (by

Indirection today Chat Blogs Web (Client/Server) Applications Hierarchical name and service structure Google (by keyword) l Ad ua n a ho c m DNS (by hostname) IP ha CDNs (by name) ck s Indirection services Connectivity 2/28/2021 Katz, Stoica F 04 63

Indirection today Chat Blogs Non client-server applications Web (Client/Server) Hierarchical name and service structure

Indirection today Chat Blogs Non client-server applications Web (Client/Server) Hierarchical name and service structure End. System Mcast Google (by keyword) Mobile IP (by home IP address) Home agent al Ad u an ho c m DNS (by hostname) IP ha CDNs (by name) ck s Application specific Applications Ka. Zaa Napster Indirection services Connectivity 2/28/2021 Katz, Stoica F 04 64

Indirection in Today’s Internet § No explicit interface that applications can build on -

Indirection in Today’s Internet § No explicit interface that applications can build on - besides DNS § Two options - Retrofit over the DNS through a variety of creative hacks - Customized solution designed/implemented anew for each application 2/28/2021 Katz, Stoica F 04 65

A DHT-enabled Internet d. Chat Client/Server Web P 2 P d. Email content publishing/distribution

A DHT-enabled Internet d. Chat Client/Server Web P 2 P d. Email content publishing/distribution d. Google SFR DNS (by keyword) (content) (by location) CDN-like (by name) directory services blogs collaborative apps p. Search (by interest) i 3 mcast rv commn. services Indirection service DHT Connectivity IP 2/28/2021 Wb File Systems (Casper, Past CFS, OStore) PIER Internet distr. systems dhash CASLIB storage services PHT Re. Hash compute services Katz, Stoica F 04 66

Another Pipe-Dream? § Will DHTs go the way of Qo. S, Multicast, etc. ?

Another Pipe-Dream? § Will DHTs go the way of Qo. S, Multicast, etc. ? § Perhaps, but DHTs don’t need the cooperation of ISPs, so the barriers to adoption are lower § Still, the chances are slim, but this is what I’m banking my career on. . 2/28/2021 Katz, Stoica F 04 67

What You Need to Know § § § Napster Gnutella DHT: basic ideas 2/28/2021

What You Need to Know § § § Napster Gnutella DHT: basic ideas 2/28/2021 Katz, Stoica F 04 68