P2P Model By: 胡飞, 王博,朱晨烨, 陈嘉禄, 韩啸,陈聪. Index • • • • • What’s P2P? Difference with other models. History of P2P. Security feature. P2P in use. – – – – Instant messenger Stream media File sharing JXTA What’s P2P • P2P is peer-to-peer • When most people hear the term peer-to-peer, the first thing that comes to mind is file sharing. Indeed, P2P has come to be synonymous with both the legal and illegal activities of people sharing copies of music, movies, and software. • Programs like Bit Torrent, eDonkey/eMule, along with many others, are examples of P2P applications. What’s P2P • A peer-to-peer (P2P) network is basically a network, the power of which lies in the computers that are connected to it rather than in a central server or anything of the kind. What’s P2P • Client-server model: communication and transaction is mediated through a central server. What’s P2P • FTP (File Transfer Protocol) The server is the central node in this architecture, housing the majority of the bandwidth and computing power. Depending on how it is configured, it controls how the clients interact. What’s P2P • In a P2P model, however, there is no centralized server, but rather an ad hoc network of peers. Each node in the network functions as both client and server simultaneously, resulting in a ever changing, organic system of participants. What’s the difference • To use FTP or HTTP download, someone has to upload a file to a central server (or at least, one of the servers), from which you can download it. It means that someone has to pay for using (or buy) a server, and someone has to take constant care of it. • Legalization: someone may find the contents of the server illegal and sue the operator. Even if he looses the trial, the server will have to be offline for some time, anyway. • Bandwidth: if the server becomes too popular, it may turn out that its bandwidth is too low, and some users have to wait in long queues or their downloads are extremely slow. • Modern P2P networks eliminate all those problems. Computers do not connect via a server; they connect directly. This means that you do not need to upload anything anywhere. You just need to tick a folder 'shared'. No one has to pay for using or buying a server. No one has to take care of it. No one can sue the operator of the server because there is no server. There is no bandwidth problem because, again, there is no server. How did it all begin • Normally, the history of P2P is divided in three stages: • Napster. Created by Shawn Fanning in 1999. Napster, unlike modern P2P, used a central server. Because people used to share copyrighted material (obviously violating the copyright laws), Napster got into legal trouble. Finally, it was shut down in 2001. However, the idea remained. • The 2nd generation of P2P is most probably what you are going to deal with. The most important difference between the 1st and the 2nd generation is that the latter is decentralized. It has no central server, the computers connect directly and therefore there is nothing to be shut down even in case copyrighted material was shared. However, such organizations as RIAA (Recording Industry Association of America) and MPAA (Motion Picture Association) undertake personal attacks against p2p users. All the most well-known p2p clients, such as eDonkey, Kazaa, iMesh, Shareaza and the like are 2nd generation p2p clients. • The 3rd generation is not yet well settled. Many programs claim to be absolutely anonymous and thus 100% secure. In fact, most of them are not. Anyway, in practice no 3rd generation client has a community big enough to really interest you at the moment. What about security • Legal trouble. This may happen if you share or download copyrighted material. We discourage you from doing that. Organizations such as RIAA (Recording Industry Association of America) and MPAA (Motion Picture Association) from time to time sue p2p users for violating copyright laws. Their mistakes (suing people who do not have computers, non-American citizens or even dead people) are usually laughed at in public. However, they have had successes, too. Peer Guardian and the like are used to protect oneself against such actions. The best way, of course, is not to breach the copyright law. • Viruses. Viruses can get you anywhere, and p2p is not an exception. Some programs perform an auto-scan of every downloaded file but most do not. In practice, you will need to run your anti-virus software more often, that is all. P2P In Use • • • • • • • Instant Messenger：QQ, MSN, Yahoo Messenger Data Storage：Farsite，Ocean Store Data Sharing：Bit Torrent，eDonkey/eMule Stream Media：PPLive, PPStream Search：Infrasearch，Pointera Co-Computing：Netbatch Games：some Chess game P2P System Distributed Computing •SETI@hom e •Avbaki, •Entropia File Sharing •Napster •Gnutella •Freenet •Publius •Free Haven CO •Magi •Groove •Jabber Platform •JXTA •.NET •.NETMyServices Instant Messenger P2P Stream Media P2P Stream Media ----shortage of server-client model • Video files too large, buffering during playing. • Too much pressure on server, timeout. • Television is instant, especially for watching sports or live shows. • Limited users online simultaneously. P2P Stream Media ----using p2p model • Make full use of Bandwidth. • The more user online, the better you feel. • It’s plays better than c/s model. • Less pressure on the server. P2P Stream Media ----principle Similar to Bit Torrent: -get file from other node -interpret into videos -share the video slice with others P2P In use ---- Bit Torrent •Software for file sharing •When downloading from others, uploading to some others. Bit Torrent ---- How to share • Sharing via HTTP, FTP Bit Torrent ---- How to share • Sharing via BT Bit Torrent ----principle • BT implements sharing via pass. • Download from someone, upload to someone. • Everyone’s both client and server. • The more user involved, the higher the speed is. Bit Torrent ----principle (details) • Tracker server – Store client information – Give information about the clients which downloaded the same file. • BT Client – – – – Communicate with Tracker Server during downloading Submit downloading status Get information of others Communicate via HTTP Bit Torrent ----principle (details) cont. • Communication process – – – – – – – – Client send out an http GET request to Tracker. Information of this client in parameter of GET. Tracker keeps info of every client. Tracker writes down client’s info when receiving a request. Tracker returns info of clients which downloads the same file to client which send out the request Client receive response from tracker. Client make connection with other clients according to the info it gets from the tracker. Client downloads file slices. Bit Torrent ----principle (details) cont. • Torrent File – Give client info to the Tracker – The content includes: • Location of the publish server • File information (file name, directory name, file size, slice size, verification code of slice) • Sharing efficiently: divide file into slices. Bit Torrent ----advantage & disadvantage • Efficient • Web server in the middle (announce) – Easy to find servers. – Announce goes down, no downloading. EDonkey •P2P Client •Download files •Upload files •Share With Others Advent Of the EDonkey • Napster: The Program to share the mp3 files. • EDonkey: More Excellent Details • More Resource to download – Download files from all the client registered in the EDonkey System. – You should share your files with others as others share their with you. Details (cont.) • Transfer More Quickly – A file can be divided to a, b, c, d; – When A transfer a to B, at the same time, C can download b from D, then B download b from C, thus, A file can be transferred more quickly. Details (cont.) • Search The Resource – Everyone has their IDs on the EDonkey System. – You can search the ID of the client if he has something you need. Accelerate The Sharing • Everyone share with others. – Quantity – Speed – Quality JXTA Concept • JXTATM is a set of open, generalized peer-topeer (P2P) protocols that allow any connected device on the network — from cell phone to PDA, from PC to server— to communicate and collaborate as peers. • The JXTA protocols are independent of any programming language, and multiple implementations (called bindings in JXTA) exist for different environments. Why JXTA ? • One primary goal of JXTA is to provide a platform with the basic functions necessary for a P2P network. In addition, JXTA technology seeks to overcome potential shortcomings in many of the existing P2P systems: • Interoperability — JXTA technology is designed to enable peers providing various P2P services to locate each other and communicate with each other. Why JXTA ? • Platform independence — JXTAtechnology is designed to be independent of programming languages, transport protocols, and deployment platforms. • Ubiquity — JXTA technology is designed to be accessible by any device with a digital heartbeat, not just PCs or a specific deployment platform. What is JXTA ? • The term “JXTA” is short for juxtapose(并置, 并列) • It is a recognition that P2P is juxtaposed to client/server or Web-based computing, which is today’s traditional distributed computing model. • The JXTAprotocols are designed to be independent of programming languages, and independent of transport protocols. What is JXTA ? • JXTA provides a common set of open protocols and an open source reference implementation for developing peer- to-peer applications. The JXTA protocols standardize the manner in which peers: – – – – – Discover each other Self-organize into peer groups Advertise and discover network services Communicate with each other Monitor each other JXTA Architecture • The JXTA software architecture is divided into three layers, as shown in JXTA Components • • • • • peer Peer groups advertisement Pipe Bidirectional reliable communication channels (JxtaSocket, and JxtaBiDiPipe) • Messages • Advertisements Key aspects of the JXTA architecture • Three essential aspects of the JXTAarchitecture distinguish it from other distributed network models: – The use of XML documents (advertisements) to describe network resources. – Abstraction of pipes to peers, and peers to endpoints without reliance upon a central naming addressing authority such as DNS. A uniform peer addressing scheme (peer IDs). – JXTA Concepts • Peers A peer is any networked device that implements one or more of the JXTA protocols. Peers can include sensors, phones, and PDAs, as well as PCs, servers, and supercomputers. Each peer operates independently and asynchronously from all other peers, and is uniquely identified by a Peer ID JXTA Concepts • Peer Groups – A peer group is a collection of peers that have agreed upon a common set of services. • Network Services – Peers cooperate and communicate to publish, discover, and invoke network services. Peers can publish multiple services. • Modules – JXTAmodules are an abstraction used to represent any piece of "code" used to implement a behavior in the JXTAworld • Pipes – JXTApeers use pipes to send messages to one another. • Message – A message is an object that is sent between JXTA peers; it is the basic unit of data exchange between peers. There are two representations for messages: XML and binary. JXTA Concepts • Advertisements • All JXTA network resources— such as peers, peer groups, pipes, and services —are represented by an advertisement. Advertisements are languageneutral meta-data structures represented as XML documents. The JXTAprotocols use advertisements to describe and publish the existence of a peer resources.