Peerto Peer Networks


Published on

Published in: Technology, Economy & Finance
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Peerto Peer Networks

  1. 1. P2P Networks Sanjoy
  2. 2. P2P networks A set of technologies that enable the direct exchange of services of data or services between computers S C C C C C C C C Client Server P P P P P P P2P Network Sanjoy
  3. 3. Network Effects: Promises & Challenges Sanjoy Can Have the following advantage… … however Scalability as there is no central resource to exhaust Has to overcome to challenge of self organization from a collection of unreliable peers with unreliable connections Aggregating resources can lead to excellent performance Has to overcome the choking of the network of overhead or organizing messages Fault resilience as there is no single point of failure Has to overcome reliability challenges on account of network congestion, isolated networks, unreachable nodes
  4. 4. Types of P2P Networks P2P Systems File Sharing Collaboration Distributed Computing Napster Limewire ( ) Aimster/Madster Gnutella ( ) Morpheus ( ) Chord Instant Messaging Groove Multiplayer Games: Magi SETI@home ( ) File Sharing is the one we will delve into in this session Sanjoy
  5. 5. Locating Content in P2P networks Sanjoy Centralized Directory Approach Flooded Request Approach Document routing Approach Peers connect to a central directory where they publish information about the content that they have to share When the directory receives a request it replies with a peer in the directory that matches the request Criteria such as proximity, bandwidth, capacity, congestion, health, frequency can guide the decision Peers broadcast a request to its directly connected peers, each of whom broadcast to their directly connected peers and so on thru the network. This continues until the request is answered or some broadcast limit is reached. Each peer has helpful but only partially complete referral information. Each referral moves the requester closer to a peer that can satisfy the query. The network can scale with a number of central servers Generates a lot of ineffective network traffic which prevents scaling Can scale effectively as systems can complete a search within a bounded number of steps
  6. 6. Napster – A quick history <ul><li>Jan 1999: Set up in Jan 1999 by Shawn Fanning (then 18) </li></ul><ul><li>December 1999: sued for copyright infringement </li></ul><ul><ul><li>file screening system wpreventing downloads of specified files put in place </li></ul></ul><ul><li>July 2001 : shut down file sharing service post court orders </li></ul><ul><li>May 2002: purchased by German media conglomerate </li></ul><ul><ul><li>Invested USD 85 million </li></ul></ul><ul><li>October 2003: Napster 2.0 a client server system goes live </li></ul><ul><ul><li>Division of Roxio </li></ul></ul>Sanjoy
  7. 7. Case Studies <ul><li>Napster </li></ul><ul><li>Gnutella & KaZaA </li></ul><ul><li>BitTorrent </li></ul>Sanjoy
  8. 8. Napster Protocol - Introduction <ul><li>Was not documented or published – reverse engineered by OpenNap ( </li></ul><ul><li>Uses the centralized directory model to locate content </li></ul><ul><li>Communicates using TCP </li></ul><ul><li>Does not use DNS to name peers: </li></ul><ul><ul><li>uses nicknames <nick> (another client) and <mynick> (this client) </li></ul></ul>Sanjoy
  9. 9. Napster Protocol Session Napster Server Client A Client B Search Request Search Response Download Request Download Ack See next two slides for message structures Establish TCP/IP connection “ 1” “ GET” Peer response Song data Sanjoy
  10. 10. Napster message structures: server - client Client announcing to server the files it is willing to share Code 100 – for this type of message <filename> <md5> <size> <bitrate> <frequency> <time> The MD 5 algorithm identifies the song and ensures that two files have identical content Client search request Code 200 – for this type of message <filename> <artist name> <song> <max results> <line speed> <bitrate> <frequency> Server Search Response Code 201 – for this message <filename> <md5> <size> <length> <nick> <ip> <link type> Download request Code 203 <nick> <file name> Download ack Code 204 <nick> <ip> <port> <filename> <md5> <linespeed> Sanjoy
  11. 11. Napster message structures: peer-peer “ 1” Single ASCII characters “ GET” Not HTTP GET – this is the Napster application protocol Peer response <mynick> <file name> <offset> - allows transfer to be resumed at any place in file Sanjoy
  12. 12. Gnutella <ul><li>Jan 1998: Justin Frankel developed Winamp, an audio player </li></ul><ul><ul><li>Then he founded Nullsoft </li></ul></ul><ul><li>May 1999: Winamp brand & services acquired by AOL </li></ul><ul><li>Early 2000: Gnutella was developed in 14 days </li></ul><ul><li>March 2000: a protoype was published under a GNU General Public License </li></ul><ul><li>In hours (before AOL could react) the software had been downloaded several times </li></ul>Sanjoy
  13. 13. Gnutella Protocol - Introduction <ul><li>Unlike Napster has no centralized service </li></ul><ul><li>Uses the flooded request approach </li></ul><ul><li>Software running in each Gnutella peer is called a servant </li></ul><ul><li>Peers use TCP/IP to communicate with each other </li></ul><ul><li>Servant software was developed by several companies: BearShare, LimeWire, ToadNode </li></ul>Sanjoy
  14. 14. Gnutella Protocol – Finding a Servant <ul><li>Specialized hosts that cache IP addresses of servants are run by companies who develop Gnutella software </li></ul><ul><li>Servant wishing to join the network contacts host cache servers and receive a list of prospective addresses </li></ul>Sanjoy
  15. 15. Gnutella message structures: descriptors The MD 5 algorithm identifies the song and ensures that two files have identical content Sanjoy Descriptor ID Payload Descriptor TTL – Time to Live Hops Payload Length Uniquely identifies this descriptor message in the network Code identifying the type of message Limits the maximum number of hops for this message 0xOO = Connection accept request 0x01 = pong Connect accept OK 0x01 = push Push file thru firewall 0x80=query File search request 0x81=queryhit Search response OK Each servant receiving a message decrements TTL count and increments the Hop count before the message is forwarded. The maximum number of hops is 7.
  16. 16. Gnutella Protocol Session Servant 1 - Joining Servant 2 – On Network Gnutella Connect Gnutella OK Ping Pong <Ip address>,<port>,<shared data> Query <filename> Host Cache Server Queryhit <filename> File Download HTTP GET Sanjoy
  17. 17. Gnutella Network Traffic A B D E C Each peer broadcasts requests to its connected peers and so on. The Pong descriptors may only be sent along the same path that carried the incoming Ping descriptor .mp3 .mp3 Get .mp3 Sanjoy
  18. 18. KazaA <ul><li>Kazaa and FastTrack were created by Niklas Zennström, Janus Friis, and Priit Kasesalu (all of whom were to later invent Skype and later on still Joost). </li></ul><ul><li>KazaA is owned by Sharman Networks, headquartered in Australia </li></ul>Sanjoy
  19. 19. KaZaA <ul><li>Based on Guntella </li></ul><ul><li>Uses SuperNodes powerful processors with high bandwidth connections </li></ul><ul><li>Peers connect to their local SuperNodes to upload information about files that they are sharing and to search </li></ul><ul><li>Hybrid system between Napster and Gnutella with similarities to the DNS system </li></ul>Sanjoy
  20. 20. BitTorrent <ul><li>April 2001: Developed by Bram Cohen </li></ul><ul><li>Become very popular </li></ul><ul><li>CBC is first public broadcaster in North America to make a full show available for download by BitTorrent </li></ul><ul><li>However, not free from controversy </li></ul>Sanjoy
  21. 21. BitTorrent - introduction <ul><li>Peers run the BitTorrent client which implements the BitTorrent protocol </li></ul><ul><li>To share, the peer creates a metadata file called the torrent </li></ul><ul><li>The torrent file is shared with the BitTorrent tracker, a server which assists </li></ul>Sanjoy
  22. 22. How BitTorrent works <ul><li>For distributing a data file </li></ul><ul><ul><li>The peer treats the file as a number of identically-sized pieces. </li></ul></ul><ul><ul><li>Creates a checksum for each piece (using the SHA1 hashing algorithm) and records it in the torrent file. </li></ul></ul><ul><ul><li>Peers that provide a complete file are called seeders </li></ul></ul><ul><li>For sharing files: </li></ul><ul><ul><li>Users download and open a torrent of interest with a BitTorrent client. </li></ul></ul><ul><ul><li>The client connects to the tracker(s) specified in the torrent file and receives a list of peers currently transferring pieces of the file(s) </li></ul></ul><ul><ul><li>The client connects to those peers to obtain the various pieces. Such a group of peers connected to each other to share a torrent is called a swarm . </li></ul></ul><ul><li>For efficiency: </li></ul><ul><ul><li>Download speed is controlled by Torrent tracking servers, who monitor all swarm users. I </li></ul></ul><ul><ul><li>Swarm users who share are rewarded by increasing the alotted swarm bandwidth </li></ul></ul><ul><ul><li>Those who leech and limit sharing, tracking servers are choked </li></ul></ul><ul><ul><li>To help newcomers, where the client reserves a portion of its available bandwidth for sending pieces to random peers Check sums ensure non corruption </li></ul></ul>Sanjoy
  23. 23. BitTorrent: How it differs from HTTP Sanjoy BitTorrent HTTP Makes many small data requests over different TCP sockets Typically a single HTTP GET request over a single TCP socket. Downloads in a random or in a &quot;rarest-first&quot; approach Downloads in a sequential manner. Downloads can take time to rise to full speed because it may take time for enough peer connections to be established, and it takes time for a node to receive sufficient data to become an effective uploader Rises to full speed very quickly and maintains this speed throughout.
  24. 24. Summary <ul><li>Fascinating History </li></ul><ul><li>Untapped potential </li></ul><ul><li>The story’s not over yet. </li></ul>Sanjoy