project jxta

39
Project JXTA Instructor: Dr. Erdogan Dogdu Presented by: Liu Shuai http://tinman.cs.gsu.edu/~cscsnlx/ ProjectJXTA.ppt

Upload: pierce

Post on 09-Jan-2016

55 views

Category:

Documents


2 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Project JXTA

Project JXTA

Instructor: Dr. Erdogan Dogdu

Presented by: Liu Shuai

http://tinman.cs.gsu.edu/~cscsnlx/ProjectJXTA.ppt

Page 2: Project JXTA

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

Page 3: Project 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.

Page 4: Project JXTA

What is P2P?

Server-Client model

Page 5: Project JXTA

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

Page 6: Project JXTA

What is P2P? (Cont.)

Peer-to-Peer model

Page 7: Project JXTA

What is P2P? (Cont.)

Advantage of P2P model1. The system is based on the direct communication

between peers 2. There is zero reliance on centralized serviced or

resources for operations 3. The system can survive extreme changes in network

composition 4. They thrive in a network with heterogeneous

environment 5. This model is highly scalable

Page 8: Project JXTA

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.

Page 9: Project JXTA

JXTA Core

JXTA Services

JXTA Applications

Structure

Any Peer on the Web (Desktop, cell phone, PDA, Server)

Security

Peer Groups Peer Pipes Peer Monitoring

JXTA Community Services SunJXTA Services

JXTA Community Applications Sun Applications

JXTAShell

PeerCommands

Page 10: Project JXTA

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.

Page 11: Project JXTA

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

Page 12: Project JXTA

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

Page 13: Project JXTA

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

Page 14: Project JXTA

Application

Create a group of peers that provide a serviceSecurely communicate with other peers on the networkFind other peers on the network with dynamic discovery across firewallsEasily share documents with anyone across the networkFind up to the minute content at network sitesMonitor peer activities remotely

Page 15: Project JXTA

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

Page 16: Project JXTA

A sample programpublic 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();

}

Page 17: Project JXTA

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) { ... }

}

Page 18: Project JXTA

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;

Page 19: Project JXTA

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

}

Page 20: Project JXTA

A sample program(cont.) static public void main(String args[]) {

DiscoveryDemo myapp = new DiscoveryDemo();

myapp.startJxta();

myapp.run();

}

}

Page 21: Project JXTA

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

Page 22: Project JXTA

Creating JXTA Systems

Instructor: Dr. Erdogan Dogdu

Presented by: Yan Gu

Page 23: Project JXTA

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

Page 24: Project JXTA

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

Page 25: Project JXTA

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? .

Page 26: Project JXTA

Solutions: Juxtaposition

GSU
Page 27: Project JXTA

Data Collector Network

GSU
Concentrators provide connection between the P2P network and the conventional client/server network where the database server and supercomputer residea bridge between the two networksa dynamic personality on the P2P network and static personality on the client/server network
Page 28: Project JXTA

Jxta Benefits for P2P Network

Uniform decentralized addressing Easy addition and removal of new collectors

or concentratorsNetwork 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

Page 29: Project JXTA

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

Page 30: Project JXTA

Network Virtualization

Page 31: Project JXTA

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

Page 32: Project JXTA

End point protocols as drivers

Page 33: Project JXTA

Jxta routing example

Page 34: Project JXTA

Fault ResiliencyP2P 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

Page 35: Project JXTA

Dynamic self-organized network

A peer with a uniform ID must Locate the local peers and discover their capabilitiesdiscover the peergroups that are available and join onediscover the services available in a peergroup and start using them

A peergroupserve as a network-partitioning mechanismensuring that advertisements are only related to he group membersalso serve authentication domain for certain applications

Page 36: Project JXTA

Weather station example

Concentrator - Jxta Services

Collector - Jxta clients

Page 37: Project JXTA

Concentrator Implementation

1. Read and process appropriate configuration file

2. Start Jxta

3. Join the group in the configuration file

4. Determine if the service ad is present. If not, create one and publish it.

5. Wait on pipe for message from collectors

6. Process the message and store in database

7. Go back to step 6

Page 38: Project JXTA

Collector Implementation1. Read and process appropriate configuration file2. Start Jxta3. Join the group specified in the configuration file4. Discover service ad by concentrator. If not, we

can not go ahead.5. Extract pipe information from service ad. 6. Collect data at timed intervals7. Create message containing the collector location

and data8. Send message to concentrator through pipe9. Go back to step 6

Page 39: Project JXTA

Application PatternTwo extremely loosely coupled populations Consumer and Producer

Consumer not willing to committed to one specific producerConsumer 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