15 Application Layer Application Layer Overall Architecture - - PDF document

15
SMART_READER_LITE
LIVE PREVIEW

15 Application Layer Application Layer Overall Architecture - - PDF document

Application Layer Application Layer File Distribution: Server-Client vs P2P File distribution time: server-client Question : How much time to distribute file Server server sequentially from one server to N peers ? u 2 F u 1 d 1 sends N


slide-1
SLIDE 1

15

Application Layer

File Distribution: Server-Client vs P2P

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

us u2 d1 d2 u1 uN dN Server Network (with abundant bandwidth) File, size F

us: server upload bandwidth ui: peer i upload bandwidth di: peer i download bandwidth

CSE Department

85

Application Layer

File distribution time: server-client

us u2 d1 d2 u1 uN dN Server Network (with abundant bandwidth) F

 server sequentially

sends N copies:

 NF/us time

 client i takes F/di

time to download

increases linearly in N (for large N) = dcs = max { NF/us, F/min(di) }

i

Time to distribute F to N clients using client/server approach

CSE Department

86

Application Layer

File distribution time: P2P

us u2 d1 d2 u1 uN dN Server Network (with abundant bandwidth) F

 server must send one

copy: F/us time

 client i takes F/di time

to download

 NF bits must be

downloaded (aggregate)  fastest possible upload rate: us + Sui dP2P = max { F/us, F/min(di) , NF/(us + Sui) }

i

CSE Department

87

Application Layer

Server-client vs. P2P: example

0.5 1 1.5 2 2.5 3 3.5 5 10 15 20 25 30 35

N Minimum Distribution Time

P2P Client-Server

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

CSE Department

88

Application Layer

File distribution: BitTorrent

tracker: tracks peers participating in torrent torrent: group of peers exchanging chunks of a file

  • btain list
  • f peers

trading chunks peer

 P2P file distribution Bram Cohen Published on April, 2001

CSE Department

89

Application Layer

Torrent File

 A .torrent file is a text file, which consists

  • f two parts

 (1) Information about Tracker  (2) Information about the file to be shared

 index of the blocks of the file  hash value of each block

CSE Department

90

slide-2
SLIDE 2

16

Application Layer

Overall Architecture

A B C

Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

91

Application Layer

Overall Architecture

A B C Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

92

Application Layer

Overall Architecture

A B C Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

93

Application Layer

Overall Architecture

A B C Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

94

Application Layer

Overall Architecture

A B C Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

95

Application Layer

Overall Architecture

A B C Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

96

slide-3
SLIDE 3

17

Application Layer

Overall Architecture

A B C Peer [Leech] Downloader “US” Peer [Seed] Peer [Leech] Tracker Web Server

CSE Department

97

Application Layer

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

CSE Department

98

Application Layer

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

CSE Department

99

Application Layer

DHT (Distributed Hash Table)

A class of a decentralized distributed system that provides a lookup service; (key, value) pairs are stored in a DHT, and any participating node can efficiently retrieve the value associated with a given key.

Responsibility for maintaining the mapping from keys to values is distributed among the nodes

CSE Department

100

Highly scalable!

Application Layer

Hash Table

CSE Department

101

Application Layer

Distributed Hash Table (DHT)

 DHT = distributed P2P database  Database has (key, value) pairs;

 key: ss number; value: human name  key: content type; value: IP address

 Peers query DB with key

 DB returns values that match the key

 Peers can also insert (key, value)

CSE Department

102

slide-4
SLIDE 4

18

Application Layer

DHT Identifiers

 Assign integer identifier to each peer in range

[0,2n-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

CSE Department

103

Application Layer

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.

 Example: n=4; peers: 1,3,4,5,8,10,12,14;

 key = 13, then successor peer = 14  key = 15, then successor peer = 1

CSE Department

104

Application Layer

1 3 4 5 8 10 12 15

Circular DHT (1)

 Each peer only aware of immediate successor

and predecessor.

 “Overlay network” Overlay Link Not the real link!

CSE Department

105

Application Layer

Circle DHT (2)

0001 0011 0100 0101 1000 1010 1100 1111

Who’s resp for key 1110 ?

I am

O(N) messages

  • n avg to resolve

query, when there are N peers

1110 1110 1110 1110 1110 1110

Define closest as closest successor

CSE Department

106

Application Layer

Circular DHT with Shortcuts

 Each peer keeps track of IP addresses of predecessor,

successor, short cuts.

 Reduced from 6 to 2 messages.  Possible to design shortcuts so O(log N) neighbors, O(log

N) messages in query

1 3 4 5 8 10 12 15

Who’s resp for key 1110?

How to achieve O(log N) search time?

CSE Department

107

Application Layer

Peer Churn

 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?

1 3 4 5 8 10 12 15

  • To handle peer churn, require

each peer to know the IP address

  • f its two successors.
  • Each peer periodically pings its

two successors to see if they are still alive.

CSE Department

108

slide-5
SLIDE 5

19

Application Layer

Chapter 2: Summary

 application architectures

 client-server  P2P  hybrid

 application service

requirements:

 reliability, bandwidth,

delay  Internet transport

service model

 connection-oriented,

reliable: TCP

 unreliable, datagrams: UDP

  • ur study of network apps now complete!

 specific protocols:

 HTTP  FTP  SMTP, POP, IMAP  DNS  P2P: BitTorrent, Skype

 socket programming

CSE Department

109

Application Layer

Chapter 2: Summary

 typical request/reply

message exchange:

 client requests info or

service

 server responds with

data, status code  message formats:

 headers: fields giving

info about data

 data: info being

communicated

Most importantly: learned about protocols

Important themes:  control vs. data msgs

 in-band, out-of-band

 centralized vs. decentralized  stateless vs. stateful  reliable vs. unreliable msg transfer  “complexity at network edge”

CSE Department

110

Application Layer

Labs with Wireshark

 The best way to learn protocols: by

"seeing protocols in action" and by "playing around with protocols"

 observing the sequence of messages exchanges

between two protocol entities

 delving down into the details of protocol

  • peration

 causing protocols to perform certain actions

and then observing these actions and their consequences.  Wireshark: a very good network protocol

analyzer

CSE Department

111

Application Layer

Wireshark

CSE Department

112

Application Layer

The User Interface

CSE Department

113

Application Layer

Labs for Chapter 2

 Two Labs

 HTTP  DNS

 Every student should complete all labs  Write your answers (HTTP & DNS) in

paper.

 Due on 30 April 2015 (Thursday)

CSE Department

114