Y. Richard Yang http://zoo.cs.yale.edu/classes/cs433/ 10/23/2018 Network Applications: Multi-Server Request Routing; Distributed Content Distribution.

Slides:



Advertisements
Similar presentations
Optimal Scheduling in Peer-to-Peer Networks Lee Center Workshop 5/19/06 Mortada Mehyar (with Prof. Steven Low, Netlab)
Advertisements

Scheduling in Web Server Clusters CS 260 LECTURE 3 From: IBM Technical Report.
Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT and Berkeley presented by Daniel Figueiredo Chord: A Scalable Peer-to-peer.
The BitTorrent Protocol
The BitTorrent Protocol. What is BitTorrent?  Efficient content distribution system using file swarming. Does not perform all the functions of a typical.
Incentives Build Robustness in BitTorrent Author: Bram Cohen Presenter: Brian Liao.
The BitTorrent protocol A peer-to-peer file sharing protocol.
Incentives Build Robustness in BitTorrent Bram Cohen.
Bit Torrent (Nick Feamster) February 25, BitTorrent Steps for publishing – Peer creates.torrent file and uploads to a web server: contains metadata.
The BitTorrent content distribution system CS217 Advanced Topics in Internet Research Guest Lecture Nikitas Liogkas, 5/11/2006.
1 Routing and Scheduling in Web Server Clusters. 2 Reference The State of the Art in Locally Distributed Web-server Systems Valeria Cardellini, Emiliano.
CompSci 356: Computer Network Architectures Lecture 21: Content Distribution Chapter 9.4 Xiaowei Yang
No Class on Friday There will be NO class on: FRIDAY 1/30/15.
Network Coding for Large Scale Content Distribution Christos Gkantsidis Georgia Institute of Technology Pablo Rodriguez Microsoft Research IEEE INFOCOM.
2/23/2004 Load Balancing February 23, /23/2004 Assignments Work on Registrar Assignment.
FRIENDS: File Retrieval In a dEcentralized Network Distribution System Steven Huang, Kevin Li Computer Science and Engineering University of California,
Modeling and Performance Analysis of Bitorrent-Like Peer-to-Peer Networks Dongyu Qiu and R. Srikant University of Illinois, 2004 Presented by : Ran Zivhon.
The Bittorrent Protocol
INTRODUCTION TO PEER TO PEER NETWORKS Z.M. Joseph CSE 6392 – DB Exploration Spring 2006 CSE, UT Arlington.
Content Overlays (Nick Feamster) February 25, 2008.
CS433/533 Computer Networks Lecture 13 CDN & P2P for Scalability 10/10/
BitTorrent Presentation by: NANO Surmi Chatterjee Nagakalyani Padakanti Sajitha Iqbal Reetu Sinha Fatemeh Marashi.
BitTorrent Internet Technologies and Applications.
Application Layer – Peer-to-peer UIUC CS438: Communication Networks Summer 2014 Fred Douglas Slides: Fred, Kurose&Ross (sometimes edited)
Introduction of P2P systems
BitTorrent Dr. Yingwu Zhu. Bittorrent A popular P2P application for file exchange!
A P2P file distribution system ——BitTorrent Pegasus Team CMPE 208.
1 BitHoc: BitTorrent for wireless ad hoc networks Jointly with: Chadi Barakat Jayeoung Choi Anwar Al Hamra Thierry Turletti EPI PLANETE 28/02/2008 MAESTRO/PLANETE.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
2: Application Layer1 Chapter 2 outline r 2.1 Principles of app layer protocols r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail r 2.5 DNS r 2.6 Socket.
Chord: A Scalable Peer-to-peer Lookup Protocol for Internet Applications Xiaozhou Li COS 461: Computer Networks (precept 04/06/12) Princeton University.
1 Distributed Hash Tables (DHTs) Lars Jørgen Lillehovde Jo Grimstad Bang Distributed Hash Tables (DHTs)
1 Slides from Richard Yang with minor modification Peer-to-Peer Systems: DHT and Swarming.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP r.
2: Application Layer 1 Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April.
Bit Torrent Nirav A. Vasa. Topics What is BitTorrent? Related Terms How BitTorrent works Steps involved in the working Advantages and Disadvantages.
INTERNET TECHNOLOGIES Week 10 Peer to Peer Paradigm 1.
PEAR TO PEAR PROTOCOL. Pure P2P architecture no always-on server arbitrary end systems directly communicate peers are intermittently connected and change.
THE BITTORRENT PROTOCOL OVERVIEW BY ANATOLY RABINOVICH AND VLADIMIR OSTROVSKY Peer-to-Peer File Sharing.
Lecture XV: Real P2P Systems
Block 5: An application layer protocol: HTTP
An example of peer-to-peer application
Review session For DS final exam.
Introduction to BitTorrent
BitTorrent Vs Gnutella.
Scaling the Network: The Internet Protocol
CSE 486/586 Distributed Systems Distributed Hash Tables
Peer-to-Peer Data Management
VIRTUAL SERVERS Presented By: Ravi Joshi IV Year (IT)
Network Applications: Smart Switch (Load Balancer) Application Overlays (P2P) Y. Richard Yang 10/12/2017.
CHAPTER 3 Architectures for Distributed Systems
Internet Networking recitation #12
Computer Communication & Networks
Designing a new BitTorrent Client
Economics and Computation Week 7: The economics of P2P file sharing
NTHU CS5421 Cloud Computing
Angelo Sapello University of Delaware
Part 4: Peer to Peer - P2P Applications
The BitTorrent Protocol
Content Distribution Networks + P2P File Sharing
Scaling the Network: The Internet Protocol
Network Applications: Multi-Server Request Routing
An Engineering Approach to Computer Networking
Consistent Hashing and Distributed Hash Table
Pure P2P architecture no always-on server
CSE 486/586 Distributed Systems Distributed Hash Tables
Chapter 2 Application Layer
Kademlia: A Peer-to-peer Information System Based on the XOR Metric
Content Distribution Networks + P2P File Sharing
Presentation transcript:

Y. Richard Yang http://zoo.cs.yale.edu/classes/cs433/ 10/23/2018 Network Applications: Multi-Server Request Routing; Distributed Content Distribution Y. Richard Yang http://zoo.cs.yale.edu/classes/cs433/ 10/23/2018

Outline Admin and recap Multiple servers

Admin Assignment Three office hours this week Exam 1 Wednesday: 1:30-2:30pm Instructor out of town Thursday and Friday: office hours Saturday/Sunday, Defer to Sunday 5 pm? Exam 1 Examples linked on the Schedule page

Recap: Designing Load-Balancing Multiple Servers Requirements/goals naming abstraction, server load balancing, failure detection, access control filtering, priorities/QoS, request locality, transparent caching Components Service/resource discovery (static, zookeeper, etcs, consul) Health/state monitoring of servers/connecting networks Load balancing mechanisms/algorithm (also called request routing) DNS request routing (indirection, hierarchy) Network request routing NAT Direct Server Return (DSR) Request routing director reliability Fully distributed servers VRRP (active/passive, priority selection multiple routers)

Outline Admin and recap Request routing to multiple servers overview DNS request routing Network request routing Overview of structure and issue Routing direction NAT Direct reply (also called Direct Server Return, DSR) Director reliability Fully distributed Active/passive Failure handling

Basic Setting: Normal hash(p) = 7 servers[hash(p) % 6] 1 2 3 4 5

Basic Setting: Server Failure hash(p) = 7 servers[hash(p) % 6] 1 2 3 4 5

Basic Setting: Server Failure Fix hash(p) = 7 servers[hash(p) % |S|] 1 2 3 4 5 Problem of fix: Existing connection using S1 is now directed to S2.

Basic Setting: Server Failure Fix Fix hash(p) = 7 if p is existing connection use connection tracking else servers[hash(p) % |S|] 1 2 3 4 5

Multiple Request Routers (Large Internet Content Providers) hash0(p) = 5 stateless router: hash0(p) % 4 1 2 3 hash(p) = 7 servers[hash(p) % 6] 1 2 3 4 5

Multiple Request Routers: Failures hash0(p) = 5 stateless router: hash0(p) % 4 1 2 3 hash(p) = 7 servers[hash(p) % 6] 1 2 3 4 5

Multiple Request Routers: Fix Server Failure hash0(p) = 5 stateless router: hash0(p) % |LB| if existing conn use conn track else servers[hash(p) % |S|] 1 2 3 hash(p) = 7 1 2 3 4 5

Multiple Request Routers: Problem hash0(p) = 5 stateless router: hash0(p) % |LB| if existing conn use conn track else servers[hash(p) % |S|] 1 2 3 hash(p) = 7 good no 1 2 3 4 5 Cause of problem: In simple hashing, failure of one server (S5) causes the connection assigned to another still-up server (S1) changed.

Ring Consistent Hashing Space is a ring Consistent hashing: m bit identifier space for both keys and nodes (servers) key identifier = SHA-1(key), where SHA-1() is a popular hash function, e.g., Key=<TCP connection tuples>  ID=60 node identifier = SHA-1(IP address) IP=“198.10.10.5”  ID=123

Request Routing using Ring K125, K5, K10 S5 IP=“198.10.10.5” N10 K11, K20 N123 Discussion: - If S5 fails, will an assignment to a non-crashed server change? Circular 7-bit ID Space N32 K101 N90 N55 - Do we still need connection table? K60 Key=hash(TCP-connection) A key is assigned at its successor: node with next higher or equal ID

Multiple Request Routers: Consistent Hash hash0(p) = 5 state less router: hash0(p) % |LB| if existing conn use conn track else servers[hash(p) % |LB] consistent_hash(p) 1 2 3 hash(p) = 7 1 2 3 4 5 Offline exercise: Failure scenarios of Ring Hash Request Routing.

Load Balance of Ring Hash 1 point per server on the ring https://blog.memcachier.com/2017/09/01/maglev-our-new-consistent-hashing-scheme/

Load Balance of Ring Hash 100 points per server on the ring https://blog.memcachier.com/2017/09/01/maglev-our-new-consistent-hashing-scheme/

Load Balance of Ring Hash 100 points per server on the ring Goal: Strict load balance among servers, still consistent hash. https://blog.memcachier.com/2017/09/01/maglev-our-new-consistent-hashing-scheme/

Google Maglev Consistent Hashing Hash every backend server to preference list of connection table positions Prime table size P for easy computation Hash every backend server to (offset, skip) ∈ [0, P-1] × [1, P-1] Each backend server i'th preference is (offset + i × skip) mod P Backend servers take turns claiming most- preferred empty bucket https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/44824.pdf

Maglev Lookup Alg

Consistent Hashing Example Permutation Table S0 S1 S2 Offset 3 Skip 4 2 1 S0 S1 S2 1 2 3 4 5 6 permutation[i] = (offset + i * skip) % 7

permutation[i] = (offset + i * skip) % 7 Consistent Hashing Example Permutation Table S0 S1 S2 Offset 3 Skip 4 2 1 S0 S1 S2 3 1 2 4 5 6 permutation[i] = (offset + i * skip) % 7

permutation[i] = (offset + i * skip) % 7 Consistent Hashing Example Permutation Table S0 S1 S2 Offset 3 Skip 4 2 1 S0 S1 S2 3 1 2 4 5 6 permutation[i] = (offset + i * skip) % 7

permutation[i] = (offset + i * skip) % 7 Consistent Hashing Example Permutation Table S0 S1 S2 Offset 3 Skip 4 2 1 S0 S1 S2 3 1 2 4 5 6 permutation[i] = (offset + i * skip) % 7

permutation[i] = (offset + i * skip) % 7 Consistent Hashing Example Permutation Table S0 S1 S2 Offset 3 Skip 4 2 1 S0 S1 S2 3 1 2 4 5 6 permutation[i] = (offset + i * skip) % 7

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 1 2 3 4 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 1 2 3 S0 4 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 2 3 S0 4 5 6 40

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 2 3 S0 4 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 2 3 S0 4 S2 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 2 3 S0 4 S2 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 2 3 S0 4 S2 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 S0 2 3 4 S2 5 6

Consistent Hashing Example Permutation Table Lookup Table S0 S1 S2 3 1 2 4 5 6 S1 1 S0 2 3 4 S2 5 6

Maglev Analysis Load balancing of Maglev is relatively clear Offline exercise: Conduct analysis on Maglev hash (used by both Google and Facebook load balancers) on disruption tolerant performance

Recap: The Request Routing Journey Requirements/goals naming abstraction, server load balancing, failure detection, access control filtering, priorities/QoS, request locality, transparent caching Components Service/resource discovery (static, zookeeper, etcs, consul) Health/state monitoring of servers/connecting networks Load balancing mechanisms/algorithm (also called request routing) Request routing mechanisms (DNS, network, hybrid) DNS request routing (indirection, hierarchy) Network request routing ARP (one level of indirection to decouple L2 IP and L3 MAC) NAT (to address socket multiplexing issue) Direct Server Return (DSR) Request routing director reliability Fully distributed VRRP (active/passive, broadcast leader election based on priority) Connection tracking to handle server churn Consistent hashing to reduce disruption (Ring Hash) Consistent hashing for load balancing (Megalev)

Recap: Typical Request Routing Direction Mechanisms App DNS name1 IP1 IP2 IPn DNS name2 - cname - hierarchy Cluster2 in Europe Cluster1 in US East in US West proxy Load balancer NLB - NAT rewrite - Direct reply Proxy as a mechanism for replica content consistency Load balancer servers

Offline Read: Amazon Load Balance https://aws.amazon.com/elasticloadbalancing/features/#Details_for_Elastic_Load_Balancing_Products https://aws.amazon.com/elasticloadbalancing/getting-started/?nc=sn&loc=4 Application LB https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html Network LB https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html

Offline Read: Amazon Elastic Cloud (EC2) Elastic Load Balancing: Network Load Balance Use the create-load-balancer command to create an Elastic Load Balancer. Use the create-target-group command to create a target group. Use the register-targets command to register the Amazon EC2 instances with the target group. Use the create-listener command to create a listener to forward requests to target group https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancer-cli.html

Offline Example: Netflix

Offline Example: Netflix Manifest File Client player authenticates and then downloads manifest file from servers at Amazon Cloud

Offline Example: Netflix Manifest File

Scalability of Server-Only Approaches origin DNS/LB edge. servers C0 client 1 client 2 client 3 client n

Server + Host Systems http://eeweb.poly.edu/faculty/yongliu/docs/imc12.pdf

An Upper Bound on Server+Host Scalability Assume need to achieve same rate to all clients only uplinks can be bottlenecks What is an upper bound on scalability? server C0 client 1 client 2 client 3 client n C1 C2 C3 Cn

The Scalability Problem Maximum throughput R = min{C0, (C0+Ci)/n} The bound is theoretically approachable server C0 client 1 client 2 client 3 client n C1 C2 C3 Cn

Theoretical Capacity: upload is bottleneck R = min{C0, (C0+Ci)/n} Assume c0 > (C0+Ci)/n Tree i: server  client i: ci /(n-1) client i  other n-1 clients Tree 0: server has remaining cm = c0 – (c1 + c2 + … cn)/(n-1) send to client i: cm/n c0 ci c1 c2 cn ci /(n-1) C0 C1 C2 Ci Cn cm /n

Why not Building the Trees? Clients come and go (churns): maintaining the trees is too expensive Each client needs N connections (not feasible for large systems) servers C0 client 1 client 2 client 3 client n C1 C2 C3 Cn

Outline Admin and recap Multi servers systems Distributed servers distributed content distribution upper bound analysis BitTorrent design distributed content distribution using Freenet [optional] distributed content distribution with anonymity (Tor) distributed content verification (Block chain)

Server+Host Content Distribution: Key Design Issues Robustness Resistant to churns and failures Efficiency A client has content that others need; otherwise, its upload capacity may not be utilized Incentive: clients are willing to upload Some real systems nearly 50% of all responses are returned by the top 1% of sharing hosts servers C0 client 1 client 2 client 3 client n C1 C2 C3 Cn

Discussion: How to handle the issues? Robustness Efficiency Incentive servers/ seeds C0 client 1 client 2 client 3 client n C1 C2 C3 Cn

Example: BitTorrent A P2P file sharing protocol Created by Bram Cohen in 2004 Spec at bep_0003: http://www.bittorrent.org/beps/bep_0003.html

BitTorrent: Content Lookup HTTP GET MYFILE.torrent http://mytracker.com:6969/ S3F5YHG6FEB FG5467HGF367 F456JI9N5FF4E … MYFILE.torrent webserver user

Metadata (.torrent) File Structure Meta info contains information necessary to contact the tracker and describes the files in the torrent URL of tracker file name file length piece length (typically 256KB) SHA-1 hashes of pieces for verification also creation date, comment, creator, …

Tracker Protocol Communicates with clients via HTTP/HTTPS Client GET request info_hash: uniquely identifies the file peer_id: chosen by and uniquely identifies the client client IP and port numwant: how many peers to return (defaults to 50) stats: e.g., bytes uploaded, downloaded Tracker GET response interval: how often to contact the tracker list of peers, containing peer id, IP and port stats

… Tracker Protocol “register” webserver user list of peers ID1 169.237.234.1:6881 ID2 190.50.34.6:5692 ID3 34.275.89.143:4545 … ID50 231.456.31.95:6882 list of peers user tracker Peer 50 … Peer 1 Peer 2

Peer Protocol: Piece-based Swarming Divide a large file into small blocks and request block-size content from different peers (why?) If do not finish downloading a block from one peer within timeout (say due to churns), switch to requesting the block from another peer Block: unit of download File Block: 16KB

Detail: Peer Protocol (Over TCP) Peers exchange bitmap representing content availability bitfield msg during initial connection have msg to notify updates to bitmap to reduce bitmap size, aggregate multiple blocks as a piece BitField/have BitField/have Remote Peer Local Peer 1 Incomplete Piece Piece 256KB

http://www.bittorrent.org/beps/bep_0003.html Peer Request If peer A has a piece that peer B needs, peer B sends interested to A unchoke: indicate that A allows B to request request: B requests a specific block from A piece: specific data 1.interested/ 3. request 2. unchoke/ 4. piece

Key Design Points request: unchoke: which data blocks to request? which peers to serve? 1.interested/ 3. request 2. unchoke/ 4. piece

Request: Block Availability Request (local) rarest first achieves the fastest replication of rare pieces obtain something of value

Block Availability: Revisions When downloading starts (first 4 pieces): choose at random and request them from the peers get pieces as quickly as possible obtain something to offer to others Endgame mode defense against the “last-block problem”: cannot finish because missing a few last pieces send requests for missing pieces to all peers in our peer list send cancel messages upon receipt of a piece

BitTorrent: Unchoke Periodically (typically every 10 seconds) calculate data-receiving rates from all peers Upload to (unchoke) the fastest constant number (4) of unchoking slots partition upload bw equally among unchoked 1.interested/ 3. request 2. unchoke/ 4. piece commonly referred to as “tit-for-tat” strategy (why?)

Optimistic Unchoking Periodically select a peer at random and upload to it typically every 3 unchoking rounds (30 seconds) Multi-purpose mechanism allow bootstrapping of new clients continuously look for the fastest peers (exploitation vs exploration)

BitTorrent Fluid Analysis Normalize file size to 1 x(t): number of downloaders who do not have all pieces at time t. y(t): number of seeds in the system at time t. : the arrival rate of new requests. : the uploading bandwidth of a given peer. c: the downloading bandwidth of a given peer, assume c ≥ μ. : the rate at which downloaders abort download. : the rate at which seeds leave the system. : indicates the effectiveness of downloader sharing, η takes values in [0, 1].

System Evolution Solving steady state: Define

System State Q: How long does each downloader stay as a downloader? 

Discussion Which protocol features of BitTorrent do you like? What are some remaining issues that the BitTorrent system does not address?