Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPE 252A : Computer Networks

Similar presentations


Presentation on theme: "CMPE 252A : Computer Networks"— Presentation transcript:

1 CMPE 252A : Computer Networks
Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 2

2 New office hours Instructor: 2-3pm Monday TA: 11am-12pm Monday

3 Limited E-device usage
Do not read unrelated webpages or use unrelated software during lectures Distractive for others If you really need to do your own work…

4 On leave Oct 11-20 Need present research papers to two conferences (ACM Mobicom and IEEE ICNP) Papers will be presented to you later during the quarter 10/12 lecture will be presented by Xin Li 10/17 lecture will be presented by Huazhe Wang 10/19 No class Introduction

5 What’s the Internet: “Nuts and Bolts” View
Internet: “network of networks” hierarchical Institutional network Mobile network Global ISP Home network Regional ISP

6 What’s the Internet: “Service” View
Communication Infrastructure enables distributed applications: Web, VoIP, , games, e-commerce, file sharing Communication services provided to apps: reliable data delivery from source to destination “best effort” (unreliable) data delivery Institutional network Mobile network Global ISP Home network Regional ISP

7 A closer look at network structure:
network edge: hosts: clients and servers servers often in data centers mobile network global ISP regional ISP home network institutional access networks, physical media: wired, wireless communication links network core: interconnected routers network of networks

8 The network core packet-switching: hosts break application-layer messages into packets forward packets from one router to the next, across links on path from source to destination each packet transmitted at full link capacity

9 Packet Switching: queueing delay, loss
R = 100 Mb/s D R = 1.5 Mb/s B E queue of packets waiting for output link queuing and loss: If arrival rate (in bits) to link exceeds transmission rate of link for a period of time: packets will queue, wait to be transmitted on link packets can be dropped (lost) if memory (buffer) fills up

10 Alternative core: circuit switching
end-end resources allocated to, reserved for “call” between source & dest: dedicated resources: no sharing circuit-like (guaranteed) performance circuit segment idle if not used by call (no sharing) Commonly used in traditional telephone networks

11 Packet switching versus circuit switching
packet switching allows more users to use network! example: 1 Mb/s link each user: 100 kb/s when “active” active 10% of time circuit-switching: 10 users packet switching: with 35 users, probability > 10 active at same time is less than * ….. N users 1 Mbps link Q: how did we get value ? Q: what happens if > 35 users ?

12 Packet switching versus circuit switching
is packet switching a “slam dunk winner?” great for bursty data resource sharing simpler, no call setup excessive congestion possible: packet delay and loss protocols needed for reliable data transfer, congestion control Q: human analogies of reserved resources (circuit switching) versus on-demand allocation (packet-switching)?

13 Internet protocol stack
application: supporting network applications FTP, SMTP, HTTP transport: process-process data transfer TCP, UDP network: routing of datagrams from source to destination IP, routing protocols link: data transfer between neighboring network elements Ethernet, (WiFi), PPP physical: bits “on the wire” application transport network link physical

14 Encapsulation source destination application transport network link
message M application transport network link physical segment Ht M Ht datagram Ht Hn M Hn frame Ht Hn Hl M link physical switch destination network link physical Ht Hn M Ht Hn Hl M M application transport network link physical Ht Hn M Ht M Ht Hn M router Ht Hn Hl M

15 Application layer Application-layer architectures
Case study: BitTorrent P2P Search and Distributed Hash Table (DHT)

16 Some network apps e-mail web instant messaging remote login
P2P file sharing multi-user network games streaming stored video clips voice over IP real-time video conferencing VoD (Youtube) Facebook Twitter Cloud ….

17 Application architectures
Client-server Peer-to-peer (P2P) Hybrid of client-server and P2P

18 Client-server architecture
always-on host permanent IP address server farms for scaling clients: communicate with server (speak first) may have dynamic IP addresses do not communicate directly with each other client/server Asymmetric protocol is easier to design than a symmetric protocol Server usually has a well-known port number for a particular service, so it is easy for client to go first (necessary) Port numbers 0 to 1023 are reserved for well-known services In P2P, a peer has to get address and port number of another peer from a super node or a tracker - a bootstrap protocol (perhaps based upon client-server paradigm) to get started!

19 Pure P2P architecture no always-on server
arbitrary end systems directly communicate peers are intermittently connected and change IP addresses Highly scalable but difficult to manage peer-peer NAT traversal problem – see wikipedia – to talk about later Each peer is like one of today client machines – may not have permanent IP address, not always ON Routing is hard (flooding), even finding IP address of another peer is hard Client-server interaction still being used. But each peer has both client and server software. Scalable in the sense that adding a new peer adds new demand, but also new capacity, but management complexity may not be scalable (e.g. use of flooding)

20 Hybrid of client-server and P2P
Skype voice-over-IP P2P application centralized server: finding address of remote party: client-client connection: direct (not through server) Direct P2P could be difficult due to NAT in firewalls – need a hack to get around - NAT traversal problem – see wikipedia While chatting between two users can be P2P, most IM services use a server to relay messages – message can be stored, not confidential! Also, chatting P2P without a server will encounter difficulty in crossing a firewall, which may disallow high numbered ports. From Wiki - Skype also routes calls through other Skype peers on the network to ease the crossing of Symmetric NATs and firewalls. This, however, puts an extra burden on those who connect to the Internet without NAT, as their computers and network bandwidth may be used to route the calls of other users.

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

22 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 For the second term, assume that the server uploads to clients in a round robin fashion so that clients can download concurrently??? increases linearly in N (for large N) 22

23 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 The summation over u_i from 1 to N. Think of the network as a large buffer – for the third term, all clints need to be uploading at the same time as well as the server, which can be accomplished in a manner similar to pipelining in our datagram packet switching diagram The last term is small when N is small, but as N increases, it will converge to F divided by the average of the upload rate, which is smaller than u_s and because, upload is always slower than download, smaller than d_min. In the limit as N becomes large, the last term determines the value of d_p2p dP2P >= max { F/us , F/min(di) , NF/(us + Sui) } i 23

24 Client-server vs. P2P: example
Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us In the limit as N goes to infinity, the average upload rate decreases to u, the minimum distribution time in the limit goes to F/u = 1 hour Assumption of just one server – what if we use N servers, the distribution time will not go up, but the cost goes up.

25 File distribution: BitTorrent
P2P file distribution torrent: group of peers exchanging chunks of a file tracker: tracks peers participating in torrent obtain list of peers trading chunks peer Initially download a metafile from a content provider, Try to connect to a torrent The metafile specifies name and size of a file, as well as finger prints of data blocks in the file, as well as a tracker server for the torrent  above not in Kurose and Ross book Later in DHT section, KR mentions that BitTorrent uses the Kademlia DHT to create a distributed tracker. The key is the torrent identifier. By querying the DHT with the key a new peer can determine the peer responsible for tracking the peers in the torrent. Each torrent has an infrastructure node called a tracker. When a peer joins a torrent, it registers itself with the tracker and periodically informs the tracker that it is still in the torrent. A given torrent may be tens of peers or more than a thousand peers. When Alice joins the tracker selects a subset of peers (say 50) from the set of participating peers and sends their IP addresses to Alice. Then Alice attempts to open concurrent TCP connections with all of the peers on the list. The ones she succeeds in establishing TCP connections are her neighboring peers. At any time, each peer has a subset of chunks of the file. Alice will ask each of her neighboring peers for a list of the chunks they have.

26 BitTorrent (1) file divided into 256KB chunks. peer joining torrent:
registers with tracker to get list of peers, connects to subset of peers (“neighbors”) has no chunks, but will accumulate them over time while downloading, peer uploads chunks to other peers. peers may come and go once a peer has entire file, it may (selfishly) leave or (altruistically) remain

27 BitTorrent (2) 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 “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 In deciding which chunks to request, Alice determines from among the chunks she does not have, the chunks that are rarest among her neighbors (chunks with the fewest repeated copies among her neighbors) and then request those rarest chunks first. Peers capable of uploading at compatible rates tend to find each other. All other neighbors beside the top four and one selected random neighbor are said to be choked. Tit-fpr-tat eliminates free-riding nodes. Different BitTorrent clients, some of which try to game the system. Modulo TCP effects and assuming last-hop bottleneck links, each peer provides an equal share of its available upload capacity to peers to which it is actively sending data. We refer to this rate throughout the paper as a peer’s equal split rate. This rate is determined by the upload capacity of a particular peer and the size of its active set. In the official reference implementation of BitTorrent, active set size is proportional to upload capacity although in other popular BitTorrent clients, this size is static.

28 Finding a better trading partner
(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 Optimistic unchoke serves to bootstrap new peers into the tit-for-tat game as well as to facilitate discovery of new, potentially better sources of data. With higher upload rate, can find better trading partners & get file faster!

29 P2P: searching for information
“Index” in P2P system: maps information to peer location (location = IP address & port number) “Index” may be a server, or may be a distributed system – it is an abstraction on this slide Each file that is shared using eMule is hashed using the MD4 algorithm. The top-level MD4 hash, file size, filename, and several secondary search attributes such as bit rate and codec are stored on eD2k servers and the serverless Kad network. The Kad network is a peer-to-peer (P2P) network which implements the Kademlia P2P overlay protocol. The majority of users on the Kad Network are also connected to servers on the eDonkey network, and Kad Network clients typically query known nodes on the eDonkey network in order to find an initial node on the Kad network.

30 P2P: centralized index original “Napster” design
directory server peers Alice Bob 1 2 3 original “Napster” design 1) when peer connects, it informs central server: IP address content 2) Alice queries for “Hey Jude” 3) Alice requests file from Bob

31 P2P: problems with centralized directory
single point of failure performance bottleneck scalability copyright infringement: “target” of lawsuit is obvious file transfer is decentralized, but locating content is highly centralized Google shows that a single server farm is reliable and scalable, so the main issue is legal

32 Query flooding overlay network: graph fully distributed
edge between peer X and Y if there’s a TCP connection all active peers and edges form overlay net edge: virtual (not physical) link given peer typically connected with < 10 overlay neighbors fully distributed no central server used by Gnutella Each peer indexes the files it makes available for sharing (and no other files) Public-domain file-sharing application, protocol spec is minimal, leaving significant flexibility in how the client is implemented

33 Query flooding Query message sent over existing TCP connections
File transfer: HTTP Query message sent over existing TCP connections peers forward Query message QueryHit sent over reverse path Query QueryHit A peer-count field in query message is set to a specific limit (say, 7) The QueryHit message follows the reverse path of the Query message, using preexisting TCP connections – need Query message ID and state information to do so Client later sets up a direct TCP connection for download using HTTP GET – note that this path is outside of the overlay network, may have difficulty if the node to download from is behind a firewall Scalability: limited scope flooding

34 Hierarchical Overlay Hybrid of centralized index, query flooding approaches each peer is either a super node or assigned to a super node TCP connection between peer and its super node. TCP connections between some pairs of super nodes. Super node tracks content in its children Typically, a group leader has a few hundred children peers Each group leader is an ordinary peer, but with higher bandwidth and connectivity than other peers An overlay network among group leaders—this overlay network is similar to Gnutella’s network in that a group leader can forward queries of its children to other group leaders (limited scope flooding also?) Who wants to be the super node?

35 Distributed Hash Table (DHT)
DHT = distributed P2P database Database has (key, value) pairs; key: content name; value: IP address Peers query database with key database returns values that match the key Peers can also insert (key, value) pairs into database Finding “needles” requires that the P2P system be structured

36 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 database is called a distributed “hash” table SHA1 hash is 160 bits, there are longer hashes MD5 hash 128 bits

37 How to assign keys to peers?
Central issue: Assigning (key, value) pairs to peers. Rule: assign to the peer that has the ID closest to key. Convention in lecture: closest is the immediate successor of the key (or equal to) Example: 4 bits; peers: 1,3,4,5,8,10,12,14; key = 13, then successor peer = 14 key = 15, then successor peer = 1 N is 128 or such

38 Consistent Hashing For n = 6, # of identifiers is 64.
The following DHT ring has 10 nodes and stores 5 keys. The successor of key 10 is node 14.

39 Circular DHT (1) 1 3 4 5 8 10 12 15 IP addresses are included in query and reply packets, so that each peer can send directly to another peer Each peer only aware of immediate successor and predecessor.

40 Circle DHT (2) 0001 0011 1111 0100 1100 0101 1010 1000 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 1110 1100 1110 0101 1110 Define closest as closest successor 1110 1010 1000

41 Circular DHT with Shortcuts
0001 Who’s resp for key 1110? 0011 1111 0100 1100 0101 1010 1000 Each peer keeps track of IP addresses of predecessor, successor, and short cuts. Reduced from 6 to 3 messages. Can design shortcuts such that O(log N) neighbors per peer, O(log N) messages per query Kurose and Ross answer is wrong, also wrong in textbook

42 Scalable Key Location – Finger Tables
keys For. start succ. 6 0+20 0+21 0+22 1 2 4 1 3 4 2 6 5 1 3 7 finger table keys For. start succ. 1 1+20 1+21 1+22 2 3 5 3 finger table keys For. start succ. 2 3+20 3+21 3+22 4 5 7

43 Peer Churn 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 Limited solution for single join or single failure Churn is highly disruptive of structured overlay networks Peer 3 also has to update its second successor info From Jay Liu about DHT churn So I dug a little more into LimeWire's DHT (Mojito, based on Kademlia). First, they have 3 types of nodes: {ref: 1. Passive Leaf: do not participate in DHT routing, but can search on DHT 2. Passive: do not participate in DHT routing (Supernode) 3. Active: full participation in DHT Nodes go into (1) if either they cannot provide DHT services, or don't yet qualify for (3) (2) is a special case where if a node is a "supernode", they actually exclude it from DHT because they don't want to burden the supernodes. In (3), a peer is in DHT. A peer is only in DHT if it exhibits "good uptime". To find out what "good" means, I dug into their source code(*), and for a node to participate in DHT, they have to have (below are default config values): # The Average uptime is 2L*60L*60L*1000L ms (i.e. 2 hours). # Current uptime exceeds 2 hours.

44 Consistent Hashing – Node Join
keys 5 7 4 2 6 5 1 3 7 keys 1 keys keys 2

45 Consistent Hashing – Node Dep.
keys 7 4 2 6 5 1 3 7 keys 1 keys 6 keys 2

46 Problem of DHT No good solution to maintain both scalable and consistent finger table under Churn. Solution of BitTorrent Maintain trackers (servers) as DHT, which are more reliable Users queries trackers to get the locations of the file File sharing are not structured.

47 DNS vs. DHT DNS DHT provides a host name to IP address mapping
relies on a set of special root servers names reflect administrative boundaries is specialized to finding named hosts or services DHT can provide same service: Name = key, value = IP requires no special servers imposes no naming structure can also be used to find data objects that are not tied to certain machines

48 Next class Please read Chapter 3-4 of the textbook BEFORE Class 48


Download ppt "CMPE 252A : Computer Networks"

Similar presentations


Ads by Google