Chapter 7: P2P Application Chapter 7: P2P Application development development Chapter goal: Chapter goal P2P applicat P2P application model P2P applicati P2P application design P2P examp P2P example What is Peer-To-Peer?(1/3 What is Peer-To-Peer?(2/3) P2P is a class of applications that P2P computing is etc)-available at the edges of the ine CPu Takes advante The sharing of computer resources and ccessing these decentralized rvices by direct exchange between esources means opera editable Peer-to-peer computing takes advantage DNS system and have significant or total of existing computing power and autonomy from central servers. networking connectivity, allowing collective power to benefit the entire enterprise. What is Peer-To-Peer? (3/3) A Brief History of P2P P2P computing is distributed a P2P is not a new technology computing with the following desirable Resource Sharing As result o de pplrcasied isemortd e aring files nare resources Dual client/server role Decentralization/Autonomy became increasingly powerful Scalabil Robustness/Self-Organization is still P2P 1999-2000, Napster shows the true potential of Pa
1 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 1 Chapter 7: P2P Application development Chapter goal: P2P application model P2P application design P2P example 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 2 Chapter 7: P2P Application development Chapter goal: P2P application model P2P application design P2P example 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 3 What is Peer-To-Peer? (1/3) P2P is a class of applications that: Takes advantage of resources – (storage, CPU, etc,..) – available at the edges of the Internet. Because accessing these decentralized resources means operating in an environment of unstable connectivity and unpredictable IP addresses, P2P nodes must operate outside the DNS system and have significant or total autonomy from central servers. 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 4 What is Peer-To-Peer? (2/3) P2P computing is: The sharing of computer resources and services by direct exchange between systems. Peer-to-peer computing takes advantage of existing computing power and networking connectivity, allowing economical clients to leverage their collective power to benefit the entire enterprise. 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 5 What is Peer-To-Peer? (3/3) P2P computing is distributed computing with the following desirable properties: Resource Sharing Dual client/server role Decentralization/Autonomy Scalability Robustness/Self-Organization 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 6 A Brief History of P2P P2P is not a new technology It has existed since the Internet was taking form in the 1970s Recent changes in technology and the improved computing capability of desktops have brought about P2P’s revival on a larger scale P2P model-based application is confined to sharing files As a result of the increased demand for Web-base services, users felt the need to control, exchange, and share resources directly Meanwhile, in the late 1990s, PCs became increasingly powerful in terms of speed and processing power Software developers realized that they could put server software on individual PCs and initiate a direct two-way data flow between two peers Led to the revival of P2P Interestingly, the IP routing infrastructure is still P2P 1999-2000, Napster shows the true potential of P2P
Application Architecture Client-server architecture Client-server a P2P nt IP address Hybrid clients: communicate with server may be intermittently addresses do not communicate directly Pure p2P architecture Hybrid of client-server and P2P Napster arbitrary end systems File transfer P2P File search centralized: peers are intermittently Peers register content at central serve Peers query same central server to locate content example: Gnutella Instant messaging Chatting between two users is P2P Presence detection/location centralized Highly scalable User registers its IP address with central server User contacts central server to find iP addresses of But difficult to manage From the Client/server Model to P2P Various P2P Models P2P-based models decrease the dependency on the P2P models can be divided into the Some P2P models do not requires servers following categories No single point of failure problems in P2P Pure P2p Both models have advantages as well as P2P with a simple discovery server Another advantage of P2P is that companies can P2P with discovery and lookup servers P2P with discovery, lookup, and content servers terms of sharing resources and costs incurred on servers
2 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 7 Application Architecture Client-server P2P Hybrid 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 8 Client-server architecture server: always-on host permanent IP address server farms for scaling clients: communicate with server may be intermittently connected may have dynamic IP addresses do not communicate directly with each other 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 9 Pure P2P architecture no always on server arbitrary end systems directly communicate peers are intermittently connected and change IP addresses example: Gnutella Highly scalable But difficult to manage 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 10 Hybrid of client-server and P2P Napster File transfer P2P File search centralized: Peers register content at central server Peers query same central server to locate content Instant messaging Chatting between two users is P2P Presence detection/location centralized: User registers its IP address with central server when it comes online User contacts central server to find IP addresses of buddies 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 11 From the Client/Server Model to P2P P2P-based models decrease the dependency on the server Some P2P models do not requires servers No single point of failure problems in P2P Both models have advantages as well as disadvantages Another advantage of P2P is that companies can build collective computing powers P2P has shaken the boundaries of networking in terms of sharing resources and costs incurred on servers 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 12 Various P2P Models P2P models can be divided into the following categories: Pure P2P P2P with a simple discovery server P2P with discovery and lookup servers P2P with discovery, lookup, and content servers
Pure P2P Model P2P with Simple Discovery Server Such P2P models do not actually n computers (clients Peers find other connected eers to the incoming ut ary assistance from a ommunication still remains the job of Pure P2P models provide almost ne chances of working with the Interne a peer has to Pzp problem with the pure cted peer individually May need more tim P2P with a Discovery and Lookup P2P with a Discovery, Lookup Server and Content Server The server dominates as in a list of connected peers along with typical client/server architecture Peers are not permitted to 旦 This model reduces the burden on connect with each other directly The server initiates communication between two peers hat the server slows down if eers establish communication too many requests come up and perform various activities multaneously There is single point of failure in server Existing P2P Applications Centralized Napster a Napste Napster used centralized servers to keep a Gnutella atalog of available files, ( 3rd model) serve The central server
3 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 13 Pure P2P Model Pure P2P model entirely depends on computers (clients in the C/S model) Peers find other connected peers on the network dynamiclly The entire communication occurs among connected peers without any assistance from a server Pure P2P models provide almost plug-and-play features for working with the Internet The only problem with the pure P2P model is finding peers 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 14 P2P with Simple Discovery Server Such P2P models do not actually involve a server The role of the server is restricted to providing the names of already connected peers to the incoming peer The server only assists peers by providing a list of connected peers Establishing connection and communication still remains the job of the peers This model increases the chances of finding a larger number of peers To download a resource, a peer has to approach each connected peer individually May need more time 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 15 P2P with a Discovery and Lookup Server The server is used to provide the list of connected peers along with the resources available This model reduces the burden on peers The server initiates communication between two peers Once again, the two connected peers establish communication, and perform various activities 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 16 P2P with a Discovery, Lookup, and Content Server The server dominates as in a typical client/server architecture Peers are not permitted to connect with each other directly All resources are stored in the database of the server Major disadvantage of this model is that the server slows down if too many requests come up simultaneously There is single point of failure in server 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 17 Existing P2P Applications Napster Gnutella 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 18 Centralized: Napster Napster used centralized servers to keep a catalog of available files. (3rd model) 1. User sends out request Napster searches central database Search request 2. The central server sends back a list of available files for download Search response Napster server user user user user 3. Requesting user downloads the file directly from another Napster user computer Download from user
Centralized: pros and cons Decentralized Every user acts as a client, a server or oth (servent). More effective, comprehensive searches User connects to framework and becomes a s Access is controlled member of the community, allowing others to connect through him/her u cons Users speak directly to other users with no System has single points of entry: one intermediate or central authority fails could bring whole system down Not one entity controls the information Broken links, out of date information. that passes through the community GNUTELLA GNUTELLA Gnutella works more or less like a pure P2P model Key terms: gnutella is downloaded and installed on the Servent: client+server sage is sent to a computer, which passes Firewall: a shield that protects inside the gnutella to the Broadcasting: messaging service between servents in Gnutella is a client-based software that has a file Gnutella sharing service and a mini search engine A machine which installed Gnutel serve the dropped et wk en ges of data that have been lost of content by sending requests Searching on Gnutella is almost like working with request to the servent for uploading the file. This is Gnutella facilitates to share all kinds of fil Port: default port number for Gnutella servents is 6346 Example: GNUTELLA Example: GNUTELLA 习ac
4 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 19 Centralized: pros and cons pros More effective, comprehensive searches Access is controlled cons System has single points of entry; one fails could bring whole system down Broken links, out of date information. 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 20 Decentralized Every user acts as a client, a server or both (servent). User connects to framework and becomes a member of the community, allowing others to connect through him/her Users speak directly to other users with no intermediate or central authority Not one entity controls the information that passes through the community 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 21 GNUTELLA Gnutella works more or less like a pure P2P model Gnutella is downloaded and installed on the computer A message is sent to a computer, which passes it to the other computers Gnutella is a client-based software that has a filesharing service and a mini search engine A machine which installed Gnutella can serve the requests of other users, and can find the desired content by sending requests Searching on Gnutella is almost like working with any other search engine Gnutella facilitates to share all kinds of files 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 22 GNUTELLA Key terms: Servent: client+server Horizon: a group of servents, not entire Gnutella Firewall: a shield that protects users inside the Gnutella Broadcasting: messaging service between servents in Gnutella Dropped Packets: packages of data that have been lost of dropped across the Gnutella nerwork Push Request: whenever a client behind the firewall is unable to download a file from a servent, the firewall send a request to the servent for uploading the file. This is called a push request. Port: default port number for Gnutella servents is 6346 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 23 Example: GNUTELLA 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 24 Example: GNUTELLA
Example: GNUTELLA Example: GNUTELLA by A though omputer A vu the same pathway. chirehttpconnecti Napster vs GNUTELLA Napster Vs GNUTELLA Napster+ s Gnutella Gives material to its customer in the form of MP3 music files all across the continents. This is the key reason fo Truly decentralized network(pure P2P No single point of failure Share all kinds of Has a provision for redirecting the request, and User friendly and easy to download Napster s Gnutella Server presence slows down or brings services to a halt in No provision for stopping the flood of requests Absence of the server makes user feel unsafe Encounters many bugs in its application, such as and the music industr Working of Various P2P Models Tracing out Other Peers The way an application works matters a lot Essential feature of every P2P-based application A typical P2P-based application can be based Discovering other peers in pure P2P-based model eerstine s dhers dynamically and communicate between Some of the key features every model P2P application should have: sescererins peers en P2P with simple discovery the database of the server stores the information related Querying peers for required content Any query for searching a particular peer is processed by Sharing content /resources with other peer Availability of a large number of peers Single point of failure of se
5 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 25 Example: GNUTELLA 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 26 Example: GNUTELLA 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 27 Napster vs GNUTELLA Napster + Gives material to its customer in the form of MP3 music files all across the continents. This is the key reason for its popularity. Provides a protective layer to its user due to the involvement of a server. Fully authenticated data travels on Napster network. User friendly and easy to download on your computer Napster - Server presence slows down or brings services to a halt in case of a technical problem Server can easily become the bottleneck Works for only MP3 files Facing copyright lawyers and the music industry 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 28 Napster vs GNUTELLA Gnutella + Truly decentralized network (pure P2P) No single point of failure Share all kinds of files Has a provision for redirecting the request, and supports HTTP protocol Gnutella - No provision for stopping the flood of requests Absence of the server makes user feel unsafe Encounters many bugs in its application, such as lost packets 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 29 Working of Various P2P Models The way an application works matters a lot A typical P2P-based application can be based on any of the models Some of the key features every model P2P application should have: Tracing out other peers Querying peers for required content Sharing content/resources with other peers 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 30 Tracing out Other Peers Essential feature of every P2P-based application Discovering other peers in pure P2P-based model Peers find others dynamically and communicate between themselves directly Affects security Discovering peers in P2P with simple discovery server-based model The database of the server stores the information related to all registered users Any query for searching a particular peer is processed by the server Enhanced security Availability of a large number of peers Single point of failure of server
Querying Peers for Required Tracing out Other Peers Content Discovering peers in P2P with discovery and lookup The user initiates the request for content Server provides a list of services as well as a list of peers Any application can make a request fo o notify their presence to the content to a peer once a peer ha traced and located Only a peer can provide the content Discovering peers in P2P with discovery, lookup, and This model traces out peers in response to a request much A peer might not entertain the query like the ot user presents or might not have the y the The dependency on the server is therefore very high Querying Peers for Required Querying Peers for Required Content Content Querying peers for content in pure P2P-based model Querying peers for content in P2P with discovery A peer passes its request for content to another peer p server-based mo If the host peer contains the required information, it not only maintains a list of registered is model provides an interchangeability of role of peers The requesting peer passes its query to the server The searching path of a peer seeking content is thereby Querying seers for sentent in P2P with simple to provide the list of logged-in The role of the server is the most significant The server not only processes the request but also itself gud sting peer has to contact each peer in the listby This method protects information from invasion Processing time is large Sharing Contents with other . Sharing Contents with other Peers Peers Sharing resources with peers in pure P2P-based Sharing resources n P2P with discovery e setthat has the requested information that he requested content Sharing resources with peers in P2P with discovery The returns the list of all connected peers d model this rist ort uired ponftenhes pee dividually This P2P model is almost like the C/s computing erver connect theg peer locates the content required,the the rerwersting peer downloads the required content from The server processes the request, procures the result Both uploading and downloading cap 6
6 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 31 Tracing out Other Peers Discovering peers in P2P with discovery and lookup server-based model Server provides a list of services as well as a list of peers All users are required to notify their presence to the server while they log in The server not only discovers other peers but also returns vital information regarding all logged in peers Reduces time consumption Discovering peers in P2P with discovery, lookup, and content server-based model This model traces out peers in response to a request much like the others The server maintains all the vital information and also furnishes the content to requesting peers Each peer is registered with the server The dependency on the server is therefore very high 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 32 Querying Peers for Required Content The user initiates the request for content Any application can make a request for content to a peer once a peer has been traced and located Only a peer can provide the content required A peer might not entertain the query the user presents or might not have the information the user seeks 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 33 Querying Peers for Required Content Querying peers for content in pure P2P-based model A peer passes its request for content to another peer (host peer) If the host peer contains the required information, it satisfies the query This model provides an interchangeability of role of peers (client or server) Querying peers for content in P2P with simple discovery server-based model This model uses a server to provide the list of logged-in peers to a requesting peer A requesting peer always gets a large number of peers of interest so it can communicate with them The requesting peer has to contact each peer in the list by itself and individually Processing time is large 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 34 Querying Peers for Required Content Querying peers for content in P2P with discovery and lookup server-based model The server not only maintains a list of registered users, but also process queries for the content The requesting peer passes its query to the server The searching path of a peer seeking content is thereby shortened Querying peers for content in P2P with discovery, lookup, and content server-based model The role of the server is the most significant The server not only processes the request but also procures the result and returns it back This method protects information from invasion 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 35 Sharing Contents with other Peers Sharing resources with peers in pure P2P-based model A peer sends a request for content to another peer Peer is the service provider which has shared resources It is the peer that has the requested information that opens the connection Sharing resources with peers in P2P with simple discovery server-based model A peer sends a request for content to the server The server returns the list of all connected peers The requesting peer approaches peers individually from this list for required content Once the requesting peer locates the content required, the server connect them The requesting peer downloads the required content from the network Uploading content cannot occur in this model 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 36 Sharing Contents with other Peers Sharing resources with peers in P2P with discovery and lookup server-based model The server doesn’t just furnish the list of peers The server carries out the search The requesting peer downloads the requested content from the network stream Uploading is also possible with this method Sharing resources with peers in P2P with discovery, lookup, and content server-based model This P2P model is almost like the C/S computing architecture All information is housed in the server The server processes the request, procures the result, and returns back Both uploading and downloading capable
Searching for shared Searching for Shared Resources Resources Important to P2P applications a Two distinct categories: Two distinct categories Client-side searching Server-side searching A server acts as the reservoir of all c地m The greatest advantage is that the user need Client-side searching is limited to the users Connection may be made of only to peers that Faster than server-side searching May send an avalanche of requests and may low down server's services Searching Technique in P2P Chapter 7: P2P Application Models development Searching for content in pure P2P-based model Searching for content in P2P with simple discovery P2P application design Searching for content in P2P with discovery and Both server-side and client-side searching can be adopted Searching for content in P2P with discovery, lookup and content server-based model nly server-side searching can be adopted Case P2P Application Structure of the P2P Application File sharing takes place between two connected peers regardless of file extensIo Three components Listener: Handles requests of incoming peer connections Server: Maintains the database required for the application Browser: Shows results to the peer through a user-friendly interface and acts as an interactive layer for the clien
7 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 37 Searching for Shared Resources Important to P2P applications Two distinct categories: Server-side searching A server acts as the reservoir of all information The greatest advantage is that the user need not worry about the location of a file Connection may be made of only to peers that possess required content May send an avalanche of requests and may slow down server’s services 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 38 Searching for Shared Resources Two distinct categories: Client-side searching Comes into play when peers are connected with each other and are communicating without the involvement of any other machine or server Client-side searching is limited to the user’s machine Faster than server-side searching 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 39 Searching Technique in P2P Models Searching for content in pure P2P-based model Client-side searching Searching for content in P2P with simple discovery server-based model Client-side searching also Searching for content in P2P with discovery and lookup server-based model Both server-side and client-side searching can be adopted Searching for content in P2P with discovery, lookup, and content server-based model Only server-side searching can be adopted 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 40 Chapter 7: P2P Application development Chapter goal: P2P application model P2P application design P2P example 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 41 Case P2P Application File sharing takes place between two connected peers regardless of file extensions Three components: Listener: Handles requests of incoming peer connections Server: Maintains the database required for the application Browser: Shows results to the peer through a user-friendly interface and acts as an interactive layer for the client 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 42 Structure of the P2P Application
Listener to Server Communication Using ASP Browser to server Using ASP 2. Logout rerun is XML Request and Response Listener to Browser Using ASP DesignSpecifications p2p_ lng mI version="1.0· woodin;a"utf-” detine1a,60’Da”1 fileinfo filemanee'Ct \TeagDonload\anes, ex Daska" Server Design- Server Design-DB login. asp Table 8
8 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 43 Listener to Server Communication Using ASP 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 44 Browser to Server Using ASP 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 45 Listener to Browser Using ASP 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 46 XML Request and Response DesignSpecifications 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 47 Server Design-DB Peer Table Share Table 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 48 Server Designlogin.asp
Server Design-logout asp Server Design-userlist asp Extract IP address from quer string rat ADODB comet and readset+int General an xML docume Server Design- earch. asp Listener Design-1 Listener Browser Design-2 Design-1
9 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 49 Server Design-logout.asp 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 50 Server Design-userlist.asp 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 51 Server Designsearch.asp 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 52 Listener Design-1 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 53 Listener Design-2 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 54 Browser Design-1
Browser Browser esion 2 Design-3 Download process Upload Process Chapter 7: P2P Application Browser Design-4 development Global Searching chapter gone P2P a greer carns out this connected berra P2P example ury arner will Client: A Comprehensive View Client: A Comprehensive Vier The peer to peer login window Share Dialog allows the user to share files of folders -Peering Peers e2001www.dreamdrchsrttw ShareFileShareFolder.2001www.deamtec hee or click bows ho sxt 厂 Add this enty or hare Files/Fakes
10 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 55 Browser Design-2 Download Process 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 56 Browser Design-3 Upload Process 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 57 Browser Design-4 Global Searching 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 58 Chapter 7: P2P Application development Chapter goal: P2P application model P2P application design P2P example 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 59 Client: A Comprehensive View The peer to peer login window 哈工大计算机学院 李全龙 Network Application Development P2P Application Development 60 Client: A Comprehensive View Share Dialog allows the user to share files of folders