390 likes | 516 Views
Project JXTA. Instructor: Dr. Erdogan Dogdu Presented by: Liu Shuai http://tinman.cs.gsu.edu/~cscsnlx/ProjectJXTA.ppt. Outline. Introduction - what is JXTA Goal - what JXTA is aiming at Structure - how JXTA is built Protocols - what protocols JXTA has
E N D
Project JXTA Instructor: Dr. Erdogan Dogdu Presented by: Liu Shuai http://tinman.cs.gsu.edu/~cscsnlx/ProjectJXTA.ppt
Outline • Introduction - what is JXTA • Goal - what JXTA is aiming at • Structure - how JXTA is built • Protocols - what protocols JXTA has • Implementation – JXTA programming in Java • Applications - what can be done with JXTA
Introduction • started by Sun's Chief Scientist Bill Joy • JXTA is pronounced as “juxta” , is short for juxtapose, as in side by side. • an effort to create a common platform for building distributed services and applications, especially for P2P networking.
What is P2P? • Server-Client model
What is P2P? (Cont.) • Problem with Server-Client Model • Scalability • As the number of users increases, there is a higher demand for computing power, storage space, and bandwidth associated with the server-side • Reliability • The whole network will depend on the highly loaded server to function properly
What is P2P? (Cont.) • Peer-to-Peer model
What is P2P? (Cont.) • Advantage of P2P model • The system is based on the direct communication between peers • There is zero reliance on centralized serviced or resources for operations • The system can survive extreme changes in network composition • They thrive in a network with heterogeneous environment • This model is highly scalable
Goals • Interoperability • — JXTA technology is designed to enable peers providing various P2P services to locate each other and communicate with each other. • Platform independence • — JXTA technology 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.
JXTA Community Applications Sun Applications JXTAShellPeerCommands JXTA Community Services SunJXTA Services Peer Groups Peer Pipes Peer Monitoring Security Structure JXTA Applications JXTA Services JXTA Core Any Peer on the Web (Desktop, cell phone, PDA, Server)
Technology Concepts • Peer • Any networked device that implements one or more of the JXTA protocols • Peer group • A collection of peers that have agreed on a common set of services. • Each peer group can establish its own membership policy • One peer can belong to more than one peer group • Advertisement • An XML-structured format file describing all existing resource, such as peer, peer group, pipe, service.
Technology Concepts(Cont.) • Message • A set of name/value pairs sent between JXTA peers. • Pipe • Message transfer mechanism for service communication • A message queue supporting create, open, close, delete, send and receive operations
Protocol • JXTA is a set of six protocols • Peer Discovery Protocol - find peers, groups, advertisements • Peer Resolver Protocol - send/receive search queries for peers • Peer Information Protocol - learn peers’ status/properties • Peer Membership Protocol - sign in, sign out, authentication • Pipe Binding Protocol - pipe advertisement to pipe endpoint • Endpoint Routing Protocol - available routes to destination
Implementation • JXTA in Java • JXTA Standard platform for JDK1.3 • PJAVA for Personal Java • JXME for J2ME (CLDC/MIDP) • Implementation in other language including • C • Perl 5.0 • Python • Ruby • Smalltalk
Application • Create a group of peers that provide a service • Securely communicate with other peers on the network • Find other peers on the network with dynamic discovery across firewalls • Easily share documents with anyone across the network • Find up to the minute content at network sites • Monitor peer activities remotely
Application - examples • Connected game/chat systems so that multiple people in multiple locations can locate each other, send messages securely. • Distributed file caching/knowledge base for data sharing. To share and search file/media over the network
A sample program public class DiscoveryDemo implements DiscoveryListener { static PeerGroup netPeerGroup = null; private DiscoveryService discovery; PeerAdvertisement peerAdv; public DiscoveryDemo() { . . . } // method to start the JXTA platform private void startJxta() { try { netPeerGroup = PeerGroupFactory.newNetPeerGroup(); }catch ( PeerGroupException e) { ... } // Get the discovery service from our peer group discovery = netPeerGroup.getDiscoveryService(); }
A sample program(cont.) //This thread loops forever discovering peers every minute, and displaying the results. public void run() { try { // Add ourselves as a DiscoveryListener for DiscoveryResponse events discovery.addDiscoveryListener(this); while (true) { System.out.println("Sending a Discovery Message"); // look for any peer discovery.getRemoteAdvertisements(null, DiscoveryService.PEER,null, null, 5, null); // wait a bit before sending next discovery message try { Thread.sleep(10 * 1000); } catch(Exception e) { ... } } //end while } catch(Exception e) { ... } }
A sample program(cont.) public void discoveryEvent(DiscoveryEvent ev) { DiscoveryResponseMsg res = ev.getResponse(); String aRes = res.getPeerAdv(); try { InputStream is = new ByteArrayInputStream( (aRes).getBytes() ); peerAdv = (PeerAdvertisement) AdvertisementFactory.newAdvertisement( new MimeMediaType( "text/xml" ), is); System.out.println (" [ Got a Discovery Response ["+ res.getResponseCount()+ " elements] from peer : " + peerAdv.getName() +" ]"); } catch (java.io.IOException e) { ... } Enumeration enum = res.getResponses(); String str=null; PeerAdvertisement newAdv=null;
A sample program(cont.) while (enum.hasMoreElements()) { try { str = (String) enum.nextElement(); newAdv =(PeerAdvertisement) AdvertisementFactory.newAdvertisement (new MimeMediaType ("text/xml"), new ByteArrayInputStream(str.getBytes())); System.out.println(" Peer name = " + newAdv.getName()); } catch (java.io.IOException e) { ... } } } // end while }
A sample program(cont.) static public void main(String args[]) { DiscoveryDemo myapp = new DiscoveryDemo(); myapp.startJxta(); myapp.run(); } }
Reference • L. Gong, "Sun's Project JXTA: A technology Overview," http://www.jxta.org/project/www/docs/TechOverview.pdf • 'Project JXTA': A Technology Overview, JavaOne 2001 • Project JXTA: Java™ Programmer’s Guide http://www.jxta.org
Creating JXTA Systems Instructor: Dr. Erdogan Dogdu Presented by: Yan Gu
Outline • Application level design and architecture • a top-down look at Jxta • A distributed data collection problem. • Analyze and design a solution through Jxta • How Jxta changes the networking landscape by juxtaposition • Jxta Service and Client
A specific example Create a large-scale distributed weather data collection and analysis system. • Collectors: • Are weather data collection points • Dispersed all over the world • Not all of them connected directly to the Internet • May go online or offline at anytime. • Concentrator: • Monitors data from many collectors • feed data in realtime into relational database • Vary in number and location • Relational Database • Supercomputer: • Analysis for data from relational database
Problem to solve how can our system • operate continuously • allow for the dynamic addition and removal of both collectors and concentrators • with little impact on overall performance? .
Jxta Benefits for P2P Network • Uniform decentralized addressing • Easy addition and removal of new collectors or concentrators • Network virtualization • simplicity in design • Fault Resiliency • continuous operations • Dynamic self-organized network • maintenance-free operations • Support for a diversity of implementations • hardward platforms, programming languages, and communication protocols
Unique Identifier • Uniquely identify an entity and serves to locate it • No central name server like DNS • Presented as URN • Sort of URI • 64 bytes array • Typical id: • urn:jxta:uuid 59616261646162…C8168F0E4BDA903
Peer Endpoint Protocol • Used to dynamically find a route to send a message to another peer • Uses queries send to other routers • Caches route information locally and uses remote peers • Uses the relay service for peers that are not reachable (firewall) • Leasing mechanism • Uses the Endpoint service to send messages • The PeerAdvertisement contains a list of Transport Protocols • Endpoint service used to delegate the sending part to the appropriate protocol
Fault Resiliency • P2P network topology will change • unreliable nature of P2P peer • reroute message on the fly as peers come and go in the network • peergroup level • support peergroup service -- redundantly implemented services that should always be available within a peergroup
Dynamic self-organized network A peer with a uniform ID must • Locate the local peers and discover their capabilities • discover the peergroups that are available and join one • discover the services available in a peergroup and start using them A peergroup • serve as a network-partitioning mechanism • ensuring that advertisements are only related to he group members • also serve authentication domain for certain applications
Weather station example • Concentrator - Jxta Services • Collector - Jxta clients
Concentrator Implementation • Read and process appropriate configuration file • Start Jxta • Join the group in the configuration file • Determine if the service ad is present. If not, create one and publish it. • Wait on pipe for message from collectors • Process the message and store in database • Go back to step 6
Collector Implementation • Read and process appropriate configuration file • Start Jxta • Join the group specified in the configuration file • Discover service ad by concentrator. If not, we can not go ahead. • Extract pipe information from service ad. • Collect data at timed intervals • Create message containing the collector location and data • Send message to concentrator through pipe • Go back to step 6
Application Pattern • Two extremely loosely coupled populations • Consumer and Producer • Consumer not willing to committed to one specific producer • Consumer may want • Select the best producers at any time • Reduce dependence on one single producer • Choose from one large dynamic community whose size and topology is unmanageable