Presentation is loading. Please wait.

Presentation is loading. Please wait.

No Class on Friday There will be NO class on: FRIDAY 1/30/15.

Similar presentations


Presentation on theme: "No Class on Friday There will be NO class on: FRIDAY 1/30/15."— Presentation transcript:

1 No Class on Friday There will be NO class on: FRIDAY 1/30/15

2 EECS340 Final Exam Hi Aleksandar,
EECS 340 final exam will be scheduled Wednesday, March 18 from 3-5pm. Regards, Lana

3 Pure P2P architecture no always-on server
arbitrary end systems directly communicate peers are intermittently connected and change IP addresses Three topics: file distribution searching for information case Study: Skype peer-peer 3

4 File Distribution: Server-Client vs P2P
Question : How much time to distribute file from one server to N peers? us: server upload bandwidth Server ui: peer i upload bandwidth u1 d1 u2 d2 us di: peer i download bandwidth File, size F dN Network (with abundant bandwidth) uN 4

5 File distribution time: server-client
server sequentially sends N copies: NF/us time client i takes F/di time to download F u2 u1 d1 d2 us Network (with abundant bandwidth) dN uN = dcs = max { NF/us, F/min(di) } i Time to distribute F to N clients using client/server approach increases linearly in N (for large N) 5

6 File distribution time: P2P
Server server must send one copy: F/us time client i takes F/di time to download NF bits must be downloaded (aggregate) F u2 u1 d1 d2 us Network (with abundant bandwidth) dN uN fastest possible upload rate: us + Sui dP2P = max { F/us, F/min(di) , NF/(us + Sui) } i 6

7 Server-client vs. P2P: example
Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us 7

8 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 8

9 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 9

10 BitTorrent (2) Pulling Chunks
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” 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 Rarest first: from among the chunks she does not have, the chunks that are the rarest among the neighbors should be asked first. In this way, the rarest data gets distributed first. The top 4 peers are called “unchoked”. Every 30 seconds Alice randomly choose a new trading partner (peer) and initiate trading with that partner. If the 2 peers are happy with the trading, they will remain connected. All other peers below top 5 do not get any data from Alice -- they 10

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

12 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) peers 12

13 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. e.g., key = h(“Led Zeppelin IV”) this is why they call it a distributed “hash” table To create integers out of the keys (such as “Led Zeppelin IV”), we will use a hash function that maps each key (e.g., a social security number or “Led Zeppelin IV”) to an integer in the range [0, 2^n -1]. A hash function is a many-to-one function for which two different inputs can have the same output (same integer), but the likelihood is extremely small. 13

14 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. e.g.,: n=4; peers: 1,3,4,5,8,10,12,14; key = 13, then successor peer = 14 key = 15, then successor peer = 1 Given that each peer has an integer identifier and that each key is also an integer identifier n the same range, a natural approach is to assign each (key, value) pair to the peer whose identifier is closest to the key. Suppose that n=4, hence [0,15]. Suppose that there are 8 peers: 1,3,4,5,8,10,12,14 How to insert a (key, value) pair? Find the responsible peer (closest to the key value). But how to find a peer that is closest to the key? 14

15 Circular DHT (1) 1 3 4 5 8 10 12 15 Each peer is only aware of its immediate successor; e.g., peer 5 knows the IP address and identifier for peer 8 but does not necessarily know anything about any other peers that may be in the DHT. “Overlay network” means that peers form an abstract logical network which resides above “underlay” computer network consisting of physical links, routers, and hosts. In the figure there are 8 nodes and 8 links in the overlay. By default a peer is aware of its predecessor because it is sending the messages. each peer only aware of immediate successor and predecessor. “overlay network” 15

16 Define closest as closest successor
Circular DHT (2) 0001 O(N) messages on avg to resolve query, when there are N peers Who’s resp for key 1110 ? I am 0011 1111 1110 0100 1110 If not responsible – keeps sending the question. If responsible (node 12 in this case), it sends the response directly to the originator. Although each peer is only aware of two neighboring peers, to find the node responsible for a key it takes: N messages in the worst case and N/2 on average. Thus, there is a tradeoff between the # of neighbors each peer has to track and the # of messages that the DHT needs to send to resole a query. Full mesh  1 query Predecessor and successor  N/2 on average. 1110 1100 1110 0101 1110 Define closest as closest successor 1110 1010 1000 16

17 Circular DHT with Shortcuts
1 3 4 5 8 10 12 15 Who’s resp for key 1110? Keep circular DHT as the foundation, but add “shortcuts” so that each peer keeps track not only of immediate successor ,but also of a relatively small number of shortcut peers scattered around the circle. Example in the figure. When receives a request, a peer sends a request either to the successor or to one of the shortcuts, whichever is closest to the key. 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 17

18 Peer Churn peer 5 abruptly leaves
1 3 4 5 8 10 12 15 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. 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? If 13 wants to join: Assumption: knows only about 1’s IP address. It then sends the question: “What will be 13’s predecessor and successor?” Reaches 12 who realizes that it will be predecessor (because its current successor is larger than 13, it is15). Peer 12 then sends this predecessor and successor information to peer 13. 13 can now join by making 15 its successor and by notifying peer 12 that it should change its immediate successor to 13. BitTorrent uses the Kademlia DHT to create a distributed tracker. In BitTorrent, the key is the torrent identifier and the value is the IP address of all the peers currently participating in the torrent. Thus, bu queuring the DHT with a torrent identifier, a newly arriving peer can query it for a list of other peers in the torrent. 18

19 P2P Case study: Skype inherently P2P: pairs of users communicate.
Skype clients (SC) 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 Supernode (SN) Skype employs P2P techniques for 2 other important functions, namely, for user location and for NAT traversal. 19

20 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 When Alice and Bob sign in, they open a connection to their relays. Once Alice calls Bob, the call is routed to Bob’s relay, and the relay then forwards the request to Bob. 20

21 Transport Layer Our goals:
understand principles behind transport layer services: multiplexing/demultiplexing reliable data transfer flow control congestion control learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport TCP congestion control

22 Outline Transport-layer services Multiplexing and demultiplexing
Connectionless transport: UDP

23 Transport services and protocols
provide logical communication between app processes running on different hosts transport protocols run in end systems send side: breaks app messages into segments, passes to network layer rcv side: reassembles segments into messages, passes to app layer more than one transport protocol available to apps Internet: TCP and UDP application transport network data link physical network data link physical network data link physical network data link physical logical end-end transport network data link physical network data link physical application transport network data link physical

24 Transport vs. network layer
Household analogy: 12 kids sending letters to 12 kids processes = kids app messages = letters in envelopes hosts = houses transport protocol = parents network-layer protocol = postal service network layer: logical communication between hosts transport layer: logical communication between processes relies on, enhances, network layer services


Download ppt "No Class on Friday There will be NO class on: FRIDAY 1/30/15."

Similar presentations


Ads by Google