Cours 7 (18 novembre 2011

Download Report

Transcript Cours 7 (18 novembre 2011

Cours 7 (18 novembre 2011

DNS, Pair à pair

DNS

DNS services  hostname to IP address translation    host aliasing  Canonical, alias names mail server aliasing load distribution  replicated Web servers: set of IP addresses for one canonical name Why not centralize DNS?

 single point of failure    traffic volume distant centralized database maintenance doesn’t scale! H. Fauconnier M2-Internet 2

Distributed, Hierarchical Database

Root DNS Servers com DNS servers org DNS servers edu DNS servers yahoo.com

DNS servers amazon.com

DNS servers pbs.org

DNS servers poly.edu

umass.edu

DNS servers DNS servers Client wants IP for www.amazon.com; 1 st  approx: client queries a root server to find com DNS server   client queries com DNS server to get amazon.com DNS server client queries amazon.com DNS server to get IP address for www.amazon.com

H. Fauconnier M2-Internet 3

DNS: Root name servers

  contacted by local name server that can not resolve name root name server:    contacts authoritative name server if name mapping not known gets mapping returns mapping to local name server e NASA Mt View, CA f Internet Software C. Palo Alto, CA (and 36 other locations) a Verisign, Dulles, VA c Cogent, Herndon, VA (also LA) d U Maryland College Park, MD g US DoD Vienna, VA h ARL Aberdeen, MD j Verisign, ( 21 locations) k RIPE London (also 16 other locations) i Autonomica, Stockholm (plus 28 other locations) m WIDE Tokyo (also Seoul, Paris, SF) 13 root name servers worldwide b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA H. Fauconnier M2-Internet 4

TLD and Authoritative Servers

 

Top-level domain (TLD) servers:

   responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp.

Network Solutions maintains servers for com TLD Educause for edu TLD

Authoritative DNS servers:

  organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web, mail).

can be maintained by organization or service provider H. Fauconnier M2-Internet 5

Local Name Server

   does not strictly belong to hierarchy each ISP (residential ISP, company, university) has one.

 also called “default name server” when host makes DNS query, query is sent to its local DNS server  acts as proxy, forwards query into hierarchy H. Fauconnier M2-Internet 6

DNS name resolution example

 Host at cis.poly.edu wants IP address for gaia.cs.umass.edu

iterated query:  contacted server replies with name of server to contact  “I don’t know this name, but ask this server” 2 3 4 5 TLD DNS server local DNS server

dns.poly.edu

1 8 7 6 requesting host

cis.poly.edu

root DNS server authoritative DNS server

dns.cs.umass.edu

gaia.cs.umass.edu

H. Fauconnier M2-Internet 7

DNS name resolution example

recursive query:  puts burden of name  resolution on contacted name server heavy load?

2 local DNS server

dns.poly.edu

1 8 7 root DNS server 6 3 5 4 TLD DNS server authoritative DNS server

dns.cs.umass.edu

requesting host

cis.poly.edu

H. Fauconnier

gaia.cs.umass.edu

M2-Internet 8

DNS: caching and updating records

  once (any) name server learns mapping, it

caches

mapping   cache entries timeout (disappear) after some time TLD servers typically cached in local name servers • Thus root name servers not often visited update/notify mechanisms under design by IETF   RFC 2136 http://www.ietf.org/html.charters/dnsind-charter.html

H. Fauconnier M2-Internet 9

DNS records

DNS: distributed db storing resource records (RR) RR format:

(name, value, type, ttl)

 Type=A  

name value

is hostname is IP address  Type=NS 

name

is domain (e.g. foo.com) 

value

is hostname of authoritative name server for this domain  Type=CNAME 

name

is alias name for some “canonical” (the real) name  www.ibm.com is really servereast.backup2.ibm.com

value

is canonical name  Type=MX 

value

is name of mailserver associated with

name

H. Fauconnier M2-Internet 10

DNS protocol, messages

DNS protocol :

query

and

reply

same

message format

messages, both with msg header  identification: 16 bit # for  query, reply to query uses same # flags:  query or reply   recursion desired recursion available  reply is authoritative H. Fauconnier M2-Internet 11

DNS protocol, messages

Name, type fields for a query RRs in response to query records for authoritative servers additional “helpful” info that may be used H. Fauconnier M2-Internet 12

Inserting records into DNS

  example: new startup “Network Utopia” register name networkuptopia.com at DNS

registrar

(e.g., Network Solutions)   provide names, IP addresses of authoritative name server (primary and secondary) registrar inserts two RRs into com TLD server: (networkutopia.com, dns1.networkutopia.com, NS) (dns1.networkutopia.com, 212.212.212.1, A)   create authoritative server Type A record for www.networkuptopia.com; Type MX record for How do people get IP address of your Web site?

H. Fauconnier M2-Internet 13

Chapter 2: Application layer

     2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail  SMTP, POP3, IMAP 2.5 DNS    2.6 P2P applications 2.7 Socket programming with UDP 2.8 Socket programming with TCP H. Fauconnier M2-Internet 14

P2P file sharing

Example  Alice runs P2P client application on her notebook computer    Intermittently connects to Internet; gets new IP address for each connection Asks for “Hey Jude” Application displays other peers that have copy of Hey Jude.

H. Fauconnier    Alice chooses one of the peers, Bob.

File is copied from Bob’s PC to Alice’s notebook: HTTP While Alice downloads, other users uploading from Alice.

 Alice’s peer is both a Web client and a transient Web server.

All peers are servers = highly scalable!

M2-Internet 15

Pair à pair

  quelques principes     les nœuds offrent des fonctionnalités identiques (pair) volatilité importante (apparition/disparition) grande échelle et dispersion géographique dynamicité importante applications  partage de fichiers    messagerie téléphone (Skype) … différent du client-serveur H. Fauconnier M2-Internet 16

Partage de fichiers

 Communication basée sur deux types de protocoles différents  découverte et localisation des fichiers • recherche des données • mettre en contact deux (ou plusieurs) utilisateurs parmi des millions  téléchargement des fichiers H. Fauconnier M2-Internet 17

Découverte-localisation

 Base     publication des fichiers partagés avec des méta-données découverte des fichiers disponibles localisation des sources à télécharger (En plus • identification des doublons • détection des fichiers corrompus • forums) H. Fauconnier M2-Internet 18

Architecture du réseau

    Centralisée : un serveur ou un cluster sur lequel les clients se connectent (Napster) Décentralisée : il n'y a que des clients (Gnutella) Faiblement centralisée : des clients et des serveurs (Edonkey) Hybride : les clients peuvent devenir des serveurs H. Fauconnier M2-Internet 19

P2P: problems with centralized directory

   Single point of failure Performance bottleneck Copyright infringement file transfer is decentralized, but locating content is highly centralized H. Fauconnier M2-Internet 20

Pure P2P architecture

   no always-on server arbitrary end systems directly communicate peer-peer peers are intermittently connected and change IP addresses  Three topics:    File distribution Searching for information Case Study: Skype H. Fauconnier M2-Internet 21

File Distribution: Server-Client vs P2P

Question

: How much time to distribute file from one server to N peers?

File, size

F

Server u s

u 1 d 1 u 2 d 2 u s :

server upload bandwidth

u i :

peer i upload bandwidth

d i :

peer i download bandwidth

d N

Network (with abundant bandwidth)

u N

H. Fauconnier M2-Internet 22

File distribution time: server-client

  server sequentially sends N copies: 

NF/u s

time client i takes F/d i time to download

F

Server

d N u N

u s

u 1 d 1 u 2 d 2

Network (with abundant bandwidth) Time to distribute

F

to

N

clients using client/server approach = d cs = max {

NF/u s , F/min(d i ) i

} H. Fauconnier increases linearly in N (for large N) M2-Internet 23

File distribution time: P2P

   Server server must send one copy: F/u

s

time client i takes F/d i time to download NF bits must be downloaded (aggregate)  fastest possible upload rate: u s

F d N u N

+ S u i u s

u 1 d 1 u 2

Network (with

d 2

abundant bandwidth) H. Fauconnier d P2P = max {

F/u s , F/min(d i )

, NF/(u s

i

+ S u i ) } M2-Internet 24

Server-client vs. P2P: example

Client upload rate = u, F/u = 1 hour, u s = 10u, d min ≥ u s 3.5

3 2.5

2 1.5

1 0.5

0 0 P2P Client-Server 5 10 15 N 20 25 30 35 H. Fauconnier M2-Internet 25

Quelques exemples

H. Fauconnier M2-Internet 26

Query flooding: Gnutella

   fully distributed  no central server public domain protocol many Gnutella clients implementing protocol overlay network: graph  edge between peer X and Y if there’s a TCP connection    all active peers and edges is overlay net Edge is not a physical link Given peer will typically be connected with < 10 overlay neighbors H. Fauconnier M2-Internet 27

Gnutella: protocol

 Query message sent over existing TCP connections  peers forward Query message  QueryHit sent over reverse path Query QueryHit Scalability: limited scope flooding H. Fauconnier File transfer: HTTP Query QueryHit M2-Internet 28

Gnutella: Peer joining

1.

2.

3.

4.

5.

Joining peer X must find some other peer in Gnutella network: use list of candidate peers X sequentially attempts to make TCP with peers on list until connection setup with Y X sends Ping message to Y; Y forwards Ping message. All peers receiving Ping message respond with Pong message X receives many Pong messages. It can then setup additional TCP connections H. Fauconnier M2-Internet 29

Exploiting heterogeneity: KaZaA

  Each peer is either a group leader or assigned to a group leader.

  TCP connection between peer and its group leader.

TCP connections between some pairs of group leaders.

Group leader tracks the content in all its children.

ordinary peer group-leader peer neighoring relationships in overlay network H. Fauconnier M2-Internet 30

KaZaA: Querying

     Each file has a hash and a descriptor Client sends keyword query to its group leader Group leader responds with matches:  For each match: metadata, hash, IP address If group leader forwards query to other group leaders, they respond with matches Client then selects files for downloading  HTTP requests using hash as identifier sent to peers holding desired file H. Fauconnier M2-Internet 31

KaZaA tricks

    Limitations on simultaneous uploads Request queuing Incentive priorities Parallel downloading H. Fauconnier M2-Internet 32

File distribution: BitTorrent

 P2P file distribution

tracker:

tracks peers participating in torrent

torrent:

group of peers exchanging chunks of a file obtain list of peers trading chunks peer H. Fauconnier M2-Internet 33

BitTorrent (1)

     file divided into 256KB

chunks

.

peer joining torrent:  has no chunks, but will accumulate them over time  registers with tracker to get list of peers, connects to subset of peers (“neighbors”) while downloading, peer uploads chunks to other peers. peers may come and go once peer has entire file, it may (selfishly) leave or (altruistically) remain H. Fauconnier M2-Internet 34

BitTorrent (2)

Pulling Chunks  at any given time, different peers have different subsets of file chunks   periodically, a peer (Alice) asks each neighbor for list of chunks that they have.

Alice sends requests for her missing chunks  rarest first Sending Chunks: tit-for-tat  Alice sends chunks to four neighbors currently sending her chunks at the

highest rate

 re-evaluate top 4 every 10 secs  every 30 secs: randomly select another peer, starts sending chunks  newly chosen peer may join top 4  “optimistically unchoke” H. Fauconnier M2-Internet 35

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 H. Fauconnier With higher upload rate, can find better trading partners & get file faster!

M2-Internet 36

Rechercher

H. Fauconnier M2-Internet 37

Recherche par diffusion simple

 les clients ne publient rien et ne font que des requêtes  une requête est diffusée à tous les clients: • avec une limite de portée (TTL) • en évitant les cycles (identification unique de la requête, la requête contient le son chemin …) • recherche en profondeur ou en largeur  un client répond par le chemin emprunté par la requête H. Fauconnier M2-Internet 38

Filtres de Bloom

Principe:

    un ensemble E de n éléments k fonctions de hachage h i de E sur {1,m} un vecteur de m bits (le filtre) tester si x appartient à E si • si le bit h i (x)=0 pour un i non • si le bit h i (x)=1 pour tout i oui (mais peut être  On diminue les faux positifs en utilisant plusieurs fonctions de hachage • Pour m et n donné le k optimal est m/n ln 2 et la probabilité de faux-positifs est (1/2) k H. Fauconnier M2-Internet 39

Exemple: Filtres de Bloom

  Trois fonctions de hachage W n’appartient pas à E H. Fauconnier M2-Internet 40

Filtres de Bloom

 Utilisation:    mot-clés correspondant sont à 1 Les clients s'échangent les filtres Les requêtes ne sont propagées que vers les H. Fauconnier M2-Internet 41

Recherche par indexation

   Les clients publient les fichiers qu'ils partagent sur les serveurs sur lesquels ils sont connectés Les serveurs indexent les descriptions des fichiers Les clients envoient des requêtes aux serveurs pour trouver les fichiers et les localiser H. Fauconnier M2-Internet 42

Recherche par DHT

 Distributed Hash Table:  Des nœuds et des données • Un espace de clés (exemple: clés de 160 bits) • Un répartition des clés (qui possède les clés?) • Un "overlay" de connexion entre les nœuds pour qui permet de savoir quel nœud possède quelle clé .

H. Fauconnier M2-Internet 43

Distributed Hash Table (DHT)

    DHT = base de données pour P2P Contient des couples

(key, value)

 key: numero SS; value: nom  key: content type; value: adresse IP Un pair

query

 la DHT par une key retourne les values correspondant à la key Un pair peut aussi

inserer

(key, value) des couples H. Fauconnier M2-Internet 44

DHT

  Stocker un fichier f de contenu data:   Un hachage (SHA1 par exemple) produit une clé de 160 bits k à partir du nom f Par un put(k, data) sur l'overlay trouver le nœud responsable pour la clé k et lui transférer les données Rechercher un fichier f:   Par hachage (SHA1) obtenir la clé k associée à f Rechercher sur l'overlay le nœud responsable de k et récupérer les données H. Fauconnier M2-Internet 45

DHT: hachage consistant

  un identificateur unique (hachage) On associe à chaque client un identificateur unique de même taille ID   distance d entre les clés-ID Un nœud ID i possède les clés j telles que d(j,i) est minimal parmi les ID (chaque nœud possède les clés les plus proches)

Le retrait ou l’ajout d'un nœud ne modifie que les voisins

H. Fauconnier M2-Internet 46

DHT

   notion d'overlay: chaque nœud maintient des liens vers d'autres nœuds, on obtient ainsi un overlay. Comment obtenir un routage efficace Un nœud soit possède la clé soit connaît un nœud plus près de la clé: on peut utiliser algorithme glouton basé sur la clé.

On peut aussi définir d'autres algorithmes de routage sur des overlays (et définir des topologies d'overlays ayant de bonnes propriétés –degré et taille des routes).

H. Fauconnier M2-Internet 47

DHT Identifiers

   Assign integer identifier to each peer in range [0,2 n -1].

 Each identifier can be represented by n bits.

Require each key to be an integer in

same range

.

To get integer keys, hash original key.

  eg, key = h(“Led Zeppelin IV”) This is why they call it a distributed “hash” table H. Fauconnier M2-Internet 48

How to assign keys to peers?

    Central issue:  Assigning (key, value) pairs to peers.

Rule: assign key to the peer that has the

closest

ID.

Convention in lecture: closest is the

immediate successor

of the key.

Ex: n=4; peers: 1,3,4,5,8,10,12,14;   key = 13, then successor peer = 14 key = 15, then successor peer = 1 H. Fauconnier M2-Internet 49

Circular DHT (1)

1 3 15 4 12 5 10 8   Each peer only aware of immediate successor and predecessor.

“Overlay network” H. Fauconnier M2-Internet 50

Circle DHT (2)

O(N) messages on avg to resolve query, when there are N peers 1111 I am 0001 0011 Who’s resp for key 1110 ?

1110 1110 Define closest as closest successor H. Fauconnier 1100 1110 1010 1110 1110 1000 1110 0100 0101 M2-Internet 51

DHT

 exemple Chord:  points sur un cercle la distance est la longueur de l'arc orienté. L'espace des clés est décomposé en segments. Si i et j sont des nœuds adjacents, i a toutes les clés comprises entre i et j    Anneau de taille 2 m (clés de 0 à 2 m -1) Hachage par SHA1 (ID-clés réparties de façon uniforme) Chaque nœud maintient une liste de K successeurs et K prédécesseurs sur l'anneau H. Fauconnier M2-Internet 52

Peer Churn

1 15 3 4 • To handle peer churn, require each peer to know the IP address • of its two successors. Each peer periodically pings its two successors to see if they are still alive . 12 5    10 8 Peer 5 abruptly leaves Peer 4 detects; makes 8 its immediate successor; asks 8 who its immediate successor is; makes 8’s immediate successor its second successor.

What if peer 13 wants to join?

H. Fauconnier M2-Internet 53

Circular DHT with Shortcuts

1 Who’s resp for key 1110? 3 15 4 12 5 10 8    successor, short cuts.

Reduced from 6 to 2 messages.

Possible to design shortcuts so O(log N) neighbors, O(log H. Fauconnier M2-Internet 54

Chord

H. Fauconnier Chaque nœud maintient une table de nœuds à distance

(n + 2 i ) mod 2 m

M2-Internet 55

Chord

Chercher le successeur de k pour nœud n:  Soit C(k) le premier nœud successeur de (n+ 2 k-1 ) mod 2 m   Si k appartient à ]n, successor]: trouvé Sinon transmettre la demande au plus près prédécesseur f de k dans C(k)  Si les nœuds sont répartis uniformément on y arrive en m étapes (et donc en log de la taille =(2 m )) à chaque appel la distance entre le nœud et k divisée par 2.

H. Fauconnier M2-Internet 56

Un autre exemple: CAN

“Content-Addressable Network” tore de dimension d

degré = O(d) diamètre moyen = O(d n

1/d

) join

H. Fauconnier M2-Internet 57

Téléchargement

   protocoles ad-hoc (Edonkey, Bittorrent) ou http Swarming (essaim)  téléchargement d'un fichier en téléchargeant différentes parties en parallèle depuis plusieurs clients téléchargement multiple    le fichier est décomposé en n blocs calcul du hachage de chaque bloc fichier est identifié par le hachage des blocs H. Fauconnier M2-Internet 58

Succès…

June 19, 2005 - 23:00 Network Users eDonkey2K FastTrack Gnutella 4,379,883 2,482,130 1,598,329 Overnet DirectConnect MP2P Filetopia 745,472 294,255 251,137 3,455 H. Fauconnier M2-Internet 59

Quelques réseaux

  Napster   (historique) Protocole: • architecture centralisée • recherche par indexation Fasttrack     clients: Kazaa Mldonkey architecture hybride recherche par indexation et diffusion entre ultrapeers identification faible des fichiers (MD5 sur 300ko puis hachage sur 32 bits)  http (+ swarming) H. Fauconnier M2-Internet 60

Quelques réseaux

  Edonkey   Clients: Edonkeys, Emule protocole • faiblement centralisée • recherche par indexation TCP • recherche multi-serveurs par UDP • téléchargement en duplex avec bitmaps, streaming et swarming (Bittorrent dans les dernières versions) • système de crédits pour inciter au partage Overnet/Kad    télécharement Edonkey décentralisé DHT (Kademlia) H. Fauconnier M2-Internet 61

Quelques réseaux

  Gnutella     architecture hybride Recherche par diffusion courte (TTL <8) avec filtres de Bloom Gnutella et Gnutella2 téléchargement par http avec possibilité de swarming Bittorrent    pas de découverte, un fichier .torrent contient les infos sur le fichier localisation centralisée pour chaque fichier (tracker) téléchargementavec bitmaps • le client commence à forunir du contenu à ses voisins • au bout d'un certain temps il bloque les voisins qui ne répondent pas et conserve les quatre meilleurs H. Fauconnier M2-Internet 62

Quelques réseaux

 Freenet       complètement distribué publication par copie recherche par diffusion en profondeur protocole et contenu cryptés documents signés par signature digitale axé sur l'anonymat H. Fauconnier M2-Internet 63

P2P Case study: Skype

    inherently P2P: pairs of users communicate.

proprietary application-layer protocol (inferred via reverse engineering) hierarchical overlay with SNs Index maps usernames to IP addresses; distributed over SNs Skype login server Skype clients (SC) Supernode (SN) H. Fauconnier M2-Internet 64

Peers as relays

  Problem when both Alice and Bob are behind “NATs”.  NAT prevents an outside peer from initiating a call to insider peer Solution:    Using Alice’s and Bob’s SNs, Relay is chosen Each peer initiates session with relay. Peers can now communicate through NATs via relay H. Fauconnier M2-Internet 65