Download presentation
Presentation is loading. Please wait.
1
JXTA: Tech Brief Dan Berger, Suvidhean Dhirakaosal, Essia Hamouda, Demetris Zeinalipour CS 202 Spring 2003
2
Outline Problem Statement/Motivation Architecture Overview Experiments/Demonstrations Conclusions
3
Motivation Existing P2P solutions have had rapid adoption and success – so why build another? JXTA attempts to address 3 key “shortcomings” of typical P2P systems: Interoperability Platform Independence Ubiquity
4
Interoperability Gnutella for file sharing, ICQ/AIM/Yahoo/Jabber/MSN for instant messaging But none of them can talk to each other. This has led to the development of apps like Gaim (linux) and Trillian (windows) that provide a single front-end to multiple protocols. JXTA aims to standardize at the protocol level.
5
Platform Independence JXTA is “independent” of programming language, operating system, and networking platform. The core of JXTA are protocol definitions, not API’s.
6
Ubiquity JXTA was designed to be scalable to any device with a “network heartbeat” – cited examples are: Sensors Consumer electronics (toasters, cell phones) PDAs Etc.
7
The Grand Vision
8
Enough Buzzwords, Already JXTA proposes a set of services to enable building a securable logical overlay network linking “peers:” Peer Discovery Peer Resolution Rendezvous Pipe Binding Endpoint Routing
9
Gratuitous Architecture Picture
10
Just the Facts Each node in the JXTA network has a “peer id” - a “globally” unique ID (UUID) Urn:jxta:idform3-31:08:66:42:67:::91:24::73 Is Autonomous and may operate independently of all peers Peers (self)organize into peer groups – loosely hierarchical. All peers belong to the “World” group. Peers and services are advertised with advertisements (XML documents)
11
Advertisements Used to describe peers, peers groups, pipes, content, services and resources Used to pass info between peers Are presented in XML Peer Adv. Peer group Adv. Module Class Adv. Module Spec. Adv. Module Implementation Adv.
12
Discovery Query
13
Discovery LAN-based (broadcast) Invitation (in or out of band, via an advertisement) Cascaded (controlled view across discovered peers) Rendezvous (napster-esqe)
14
Resolution In general – a service that resolves advertisements into endpoints. JXTA ships with one implementation – “Rendezvous” – in which hosts serve as switchboards for messages. More complex/decentralized resolvers are possible, but not specified/provided.
15
Pipes Pipes are unidirectional communication channels. Peers can host input pipes (incoming messages), or output pipes (outgoing messages). Pipes can be chained to link peers across multiple logical hops, and can be one-to-many. Pipes are bound to peer ids, not IP address.
16
Pipe
17
Routing Allows peers to discover routes for reaching a peer which can not be directly connected to. I.e. behind a firewall, NAT device, different network platform, etc.
18
Experiments
19
Required Components www.jxta.org has Java and C implementations of the core protocols. The C version is based on the APR (apache portable runtime) and trails behind the JAVA version in terms of functionality and ease of use. For Java – requires the J2SE JDK
20
Installation & Configuration Install a JRE/JDK (e.g. Sun 1.3.1_1) Download the latest JXTAInst_VM.exe InstallAnywhere installer (JXTA v2.0) http://download.jxta.org/easyinstall/install.html (4.71MB)http://download.jxta.org/easyinstall/install.html (Or download JXTAInst.exe which contains VM) Download tutorials/code from http://www.jxta.org/project/www/Tutorials.html
21
JXTA Jars JXTA’s core uses 13 other JAR files like Jetty portable Web/Servlet Server, Log4J apache’s generic logging API. Directory Structure so far /InstantP2P -> A “full-fledged” instant P2P application /lib -> The JAR Files /lib/jxta.jar -> Contains the JXTA Programming API /Shell -> Command-line Interface to JXTA /tutorials -> Tutorials that we downloaded individually
22
import net.jxta.peergroup.*; import net.jxta.impl.id.UUID.*; import net.jxta.impl.id.binaryID.*; public class Hello { static PeerGroup netPeerGroup = null; static DigestTool digestTool = new DigestTool(); public static void main(String args[]) { try { netPeerGroup = PeerGroupFactory.newNetPeerGroup(); System.out.println("Hello from JXTA group " + netPeerGroup.getPeerGroupName() ); System.out.println(" Group ID = " + netPeerGroup.getPeerGroupID().toString()); System.out.println(" Peer name = " + netPeerGroup.getPeerName()); System.out.println(" Peer ID = " + netPeerGroup.getPeerID().toString()); } catch(Exception e) { e.printStackTrace(); } } Step 0: Source/Compiling “Creating a PeerGroup” java -classpath jxta.jar;OTHER_JAR_FILES.jar; Hello
23
Step 1 : Running the code Now a.jxta directory is created on disk which contains all settings On the next run we only fill in an authentication box 1 2 3 4
24
Step 2 : JXTA Sockets! (as of v2.0) JXTA introduces a Socket API which is similar to the familiar sockets. The Socket API attempts to make JXTA Pipe programming easier. (JxtaSocket is a bi- directional Pipe) JxtaServerSocket: Server socket that waits for connections from clients. JxtaSocket: Socket class used to create the I/O streams for both clients and servers.
25
Step 3 : JXTA Sockets Example In this example we use to types of “advertisement” Discovery Services: LAN-based discovery: Local broadcast over the subnet. (224.0.0.0 to 239.255.255.255) Works if peers are within the same subnet or if multicast- enabled routers are connecting the peers Discovery via rendezvous points A peer at a well- known address has the task of knowing and disseminating locations of peers. Works if peers are fire-walled in which case direct connection between peers is not feasible.
26
Step 3 : JXTA Sockets Example socket.adv urn:jxta:uuid-59616261646162614A757874614D504725184FBC JxtaUnicast socket example ClientServer read the text file1 Rendevouz Service My ServerSocket ID isuuid...BC 2 read the text file3 The Server I want to connect to is uuid...BC 4 FIREWALL (multicast channel) 5 a)connect, b)receive msg, c) send msg back a)connect, b)receive msg, c) send msg back 6
27
JXTA Sockets Code Snippets Server (main snippets) // create, and Start the default jxta NetPeerGroup PeerGroup netPeerGroup = PeerGroupFactory.newNetPeerGroup(); // Read file from disk FileInputStream is = new FileInputStream("socket.adv"); // Generate Pipe Advertisment PipeAdvertisement pipeAdv = (PipeAdvertisement)AdvertisementFactory. new Advertisement(is); // Launch ServerSocket JxtaServerSocket serverSocket = new JxtaServerSocket(netPeerGroup, socEx.pipeAdv); // if client connects, spawn two new Threads (input/output). JxtaSocket socket = serverSocket.accept(); OutputStream out = socket.getOutputStream(); InputStream in = socket.getInputStream(); // send a message String msg = “Hello JXTA”; out.write(msg.getbytes()); // receive message back in.read(inbuf, 0, bufsize);
28
JXTA Sockets Code Snippets Client (main snippets) // create, and Start the default jxta NetPeerGroup PeerGroup netPeerGroup = PeerGroupFactory.newNetPeerGroup(); // Read file from disk FileInputStream is = new FileInputStream("socket.adv"); // Generate Pipe Advertisment PipeAdvertisement pipeAdv = (PipeAdvertisement)AdvertisementFactory. new Advertisement(is); // Launch Socket along with 2 new Threads (input/output). JxtaSocket socket = new JxtaSocket(netPeerGroup, pipeAdv); OutputStream out = socket.getOutputStream(); InputStream in = socket.getInputStream(); // receive message read = in.read(inbuf, 0, bufsize); System.out.println(">> " + new String(inbuf)); // send message back out.write(inbuf, 0, read);
29
JXTA Sockets Code Snippets Server acting also as Rendezvous Client connecting to Rendezvous
30
Conclusions JXTAGnutellaNapsterFreenet/Chord Key Difference P2P Platform that allows the deployment of “any” P2P service P2P Protocol tailored to the needs of file- sharers (searching based on filename P2P Protocol tailored to the needs of file- sharers (searching based on filename) Algorithms for Object Location in P2P systems (searching based on keys) Architecture Any (Pure, Rendezvous (hybrid), or centralized Pure/Hybrid P2P (started out as Pure but with Limewire’s Ultra-peers moving to Hybrid) Centralized P2P Structured P2P networks (peers are positioned at well-known places) Transport HTTP or TCP/IPTCP/IP mostly TCP/IP Communication Sync/AsyncAsynchronousSynchronousAsynchronous Data Replication Open (depends on the Application) No (downloaded file not considered replication) Required Lang Bindings JAVA, “C”,Open source mostly in Java. No API. (proprietary) Java and C++
31
Ongoing JXTA Projects Full list available at : http://apps.jxta.org/servlets/ProjectHomehttp://apps.jxta.org/servlets/ProjectHome Gnougat: A Fully decentralized file caching RossetChat: Localized JXTA Peer Text Messaging Radiojxta: delivering audio content over JXTA networks P2Pconference: A tool to conduct remote, text-based conferences InstantP2P: To be interactively displayed.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.