client-server vs p2p or, http vs bittorrent. client-server architecture server client

20
Client-Server vs P2P or, HTTP vs Bittorrent

Upload: alexander-kelly

Post on 24-Dec-2015

217 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Client-Server vs P2P

or, HTTP vs Bittorrent

Page 2: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Client-Server Architecture

SERVER

client

client

client client

client

Page 3: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

CLIENT SERVER

Many clients One server

Program starts and stops Program runs continuously

Initiates connection – one server at a time.

Responds – many clients at a time.

Requests services Responds to requests

(Usually) closes connection

Holds the files / data

Any port number will do Needs a well-known port number, well known IP number

Clients never communicate with one another.

Page 4: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Example: The HTTP Protocol

CLIENT: send request message

SERVER: respond to request

Page 5: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

HTTP

1. Client initiates connection by sending a request message, then headers, then a blank line, then an optional message.

GET ccm/index.html HTTP/1.1Accept-Lang: en

--no message --

Page 6: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

HTTP

2. Server responds with a status line (status code and text), headers, a blank line, and optional text or data. Example:

HTTP1.1 200 OK Server: Apache/1.3.3.7 (Unix)Content-Length: 345 bytesContent-Type: text/html

<html><body> …the text of the page in html…

Page 7: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

HTTPEight types of client request messages:

1. GET: request a file from server2. HEAD: just send me the headers that would be sent3. POST: send input to a server program that generates

pages4. PUT: upload a file to server 5. DELETE: delete a file on server6. TRACE: echo this request 7. OPTIONS: what services does server offer8. CONNECT: open a TCP-like connection

Page 8: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

HTTP

Five categories of server response:

1xx information2xx success3xx redirection4xx client error5xx server error

Examples:

200 OK301 Moved Permanently403 Forbidden404 Not Found

Page 9: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Other Client-Server Protocols

• TCP• DNS• eMail (POP/IMAP and SMTP)• Amazon, eBay, most sites for commercial

transactions

Note: Ethernet and IP are in a different category of so-called connectionless protocols: the sender does not contact the receiver before sending the data. Client-server and peer-to-peer are both connection-oriented protocols.

Page 10: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Peer to Peer Architecture

client

server

Page 11: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Peer to Peer Network

• Every node can act as both client and server (called a peer, or client).

• The ``overlay topology’’ is the topology imposed by the connectivity tables.

• Nodes communicate directly (usually using http) with neighbors.

• Data / files are distributed (sometimes in pieces) over all the network

• Need a directory protocol to find data.• Need a transfer protocol to transfer data.

Page 12: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Client-Server vs P2pClient-Server

Centralized & less robust. Efficiency and reliability depend on server.

Popular data = more congestion = slower.

Centralized data repository: easier to maintain, more accountability, better security.

Server can control and record transactions by clients.

One server can work with a wider variety of client capabilities.

Server must be easy to find: Hence well- known port numbers.

P2P

Decentralized & more robust. No single point of failure.

Popular data = more distribution = faster.

Decentralized data: more redundancy, harder to maintain, less accountability, less security.

Transactions are not recorded, harder to trace.

Peers need to be fairly compatible.

Peers need to find each other.

Page 13: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

Example: BitTorrent

• One large file (MB,GB) broken into many pieces (64kB ..4MB), pieces broken into blocks.

• Pieces are distributed to many peers. A block is a unit of file transfer.

• Peers can run in leech mode (downloading/client) or seed mode (uploading/server).

• The tracker is a server of directory information (where to find the peers and pieces you want).

Page 14: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

BitTorrent Protocol Overview

1. Visit website to obtain a .torrent file for the song you want. This file contains info about the pieces.

2. Open the file: This contacts a tracker who gives you a (random) list of peers to connect to. The peers have the pieces you want.

3. Handshake to open a connection to each peer. 4. File transfer: peers send you pieces (leech), or you

send complete files in pieces to peers (seed). Possibly both at the same time.

5. Endgame: close connections to peers.

Page 15: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

BitTorrent Protocol

2. Visit tracker to get a (random) list of peers holding pieces you want.

• This imposes a random topology on the network, connectivity depending on what files users request. Difficult to model and predict performance.

• Trackers do not remember peer lists; peers do not reveal their own peer lists. Difficult to trace connectivity.

Page 16: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

BitTorrent Protocol

4. File transfer: • Tit-for-tat philosophy: The more you give, the

more you get. The quality of your download experience depends on your quality as an uploader.

• After you have acquired an entire file, keep the connections open so you can seed to new peers.

• You can also seed new content by contacting a tracker, which will hook you up with new peers.

Page 17: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

BitTorrent Protocol

3. File transfer protocol exchanges information about peers.

• A is Interested. If B has something A does not have, and wants.

• A is Choked. B may choke A and refuse to send content. (Perhaps A is a seed, or B is busy).

• A is Snubbed. If B is supposed to be sending but has not communicated for 60 seconds.

Page 18: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

P2P Problems

• Lots of malicious code (viruses, worms, Trojan horses, back door…) in P2P sites.

• Can suck up all the bandwidth in a network. Other network nodes experience slowdown.– Many ISP’s limit download volume per user per

month. Some accused of squashing P2P packets. – AC will throttle (slow down) a node that takes a

too high percentage of bandwidth. (AC prevents uploading P2P packets from leaving campus.)

Page 19: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

P2P and Copyright Infringement• Sony v. Universal Studios: Sony is not liable if users use Betamax

video recorders to infringe. • RIAA v. Napster: Shut down because the central server held illegal

content, and the site advertised and encouraged infringement.• MGM v. Grokster: Non-infringing uses must be significant

compared to infringing ones. Grokster induced users to infringe.• LimeWire: Users must agree not to use software for infringement

before downloading. • BitTorrent: Has licenses for all content at the company website.

Trackers do not protect anonymity of clients. • Other sites using BitTorrent code have been targets of legal action.

Page 20: Client-Server vs P2P or, HTTP vs Bittorrent. Client-Server Architecture SERVER client

P2P Legal File Sharing

• Open source software• Publications with Creative Commons license• Weedshare files (can play 3 times for free

before deciding to buy)• Copyright-free songs and recordings• Exchanging data within a company or group.• Estimate legal use growing by 400 percent per

year.