Вы находитесь на странице: 1из 9





My SDN Account







search tips


SDN Home > Products & Technologies > Java Technology > Reference > Technical Articles and Tips > Developer Technical Articles & Tips > Netw orking >


JXTA: P2P Grows Up

Print-friendly Version

by Daniel Brookshier, Sing Li, Brendon Wilson December 2002

Peer-to-Peer (P2P) is on developers' minds lately. Many people, however, have avoided the existing P2P solutions because they are usually single-purpose (limited to file sharing or chat, for example), and they lack standards and industry support. But with Sun's introduction of JXTA, P2P has grown up and graduated from a curiosity to a potent technology for delivering practical solutions to common business problems. JXTA is a set of protocols with revolutionary capabilities for the application developer. But don't confuse JXTA with instant messaging, grid computing, collaboration, or even file sharing, because JXTA is all of these things -- and more. JXTA is a set of protocols and APIs for general-purpose, computer-tocomputer communication. Current P2P-styled applications (instant messaging, file sharing, group chat, and so forth) provide solutions to specific problems. A side effect of this specialization is that the protocols used by these applications are only suitable for their intended purpose, and nothing more. In fact, in extreme cases (such as in the world of instant messaging), the most popular protocols are so specialized that even solutions within the same problem domain aren't compatible -- in other words, AOL Instant Messenger can't talk to MSN Messenger can't talk to Yahoo Messenger! Although P2P can unleash and distribute an awesome amount of computing power, storage, and bandwidth

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

New hot app: Facebook Albums To PDF


currently languishing (often underutilized) within corporate enterprises, the lack of a generic framework for constructing interoperable P2P solutions has prevented most businesses from taking full advantage of this technology's potential. This article will explain what JXTA is, some of the exciting application areas in which it is being applied right now, and explore some of the profitable potential that the technology may bring.

JXTA: The P2P Final Frontier

Project JXTA is an open-source, community-based project originally initiated by Bill Joy and Mike Clary at Sun Microsystems. The Project has now grown to over 10,000 members. The JXTA open-source community -which includes key members of Sun's own JXTA team -- has defined a set of XML-based protocols and a Java reference API to provide a generic framework for P2P. Armed with the reference implementation, developers are creating protocols in other languages, too. Software designers now have the tools they need to create innovative P2P business applications with a robust library and infrastructure.

JXTA Is All About Protocols

The JXTA Protocols Specification describes a set of XML-based protocols that provide the basic elements for P2P computing, including:

Peer discovery: A P2P solution needs a mechanism to allow a peer to find other peers, in order to access resources and services. Peer discovery protocols must enable peers to not only find peers in the local LAN, but also remote peers across the WAN or Internet, which may even be located behind a firewall or NAT equipment. Peer groups: Peer groups allow P2P applications to subdivide the network space, allowing peers to organize themselves into groups with common services, purposes, or needs for authentication/privacy. Discovery: Peers and peer groups can "advertise" to other peers the services they provide to the network. These "advertisements" describe the topology of the network, including peers, peer groups, communication channels, services, and other information. This is an important feature, because it creates a dynamic environment where the network and services available can be discovered and used as they are created. Services: JXTA includes the notion of a Peer and PeerGroup services. These services describe not only the service being provided, but also where to obtain the specifications and executable code for the service. Because services can be specified by peer group, the developer can create specific
open in browser PRO version
Are you a developer? Try out the HTML to PDF API New hot app: Facebook Albums To PDF


implementations or additions to protocols that meet the needs of the application. Services are described via XML so you can also create the same service with different languages, and then verify that they are compatible. Data transfer: JXTA provides the concept of a pipe, a channel that allows developers to transfer data between peers in an abstract fashion. JXTA provides one-to-one, secure one-to-one, and one-tomany (multicast-styled propagation) pipes for transferring data between peers. Pipes allow peers to communicate regardless of protocols, or even barriers like firewalls (for example, HTTP and TCP may be used to connect two peers via the pipe). Message routing: JXTA provides an abstract network transport capable of transporting JXTA messages between peers, either directly, or via relay peers capable of both enabling multi-hop routing of messages, and traversing firewall or NAT equipment that isolates peers from the public network. The JXTA delivery layer is capable of working across multiple protocols (not restricted to TCP/IP only), and can survive the dynamic change of network topology that constantly happens in a P2P network. Rendezvous protocol: JXTA provides the concept of a rendezvous peer, whose responsibility it is to enable peers to propagate messages to each other, as well as reduce network traffic by caching popular information essential to the operation of the P2P network.
Figure 1 illustrates how the peers in a P2P network can discover, communicate, and interoperate with one another using the JXTA protocols.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

New hot app: Facebook Albums To PDF


Figure 1: JXTA Network Overview (Click image to enlarge.)

Exploring JXTA
Java developers can start experimenting with P2P applications immediately, since the JXTA reference implementation for the Java programming language is a mature codebase that has been through over a year of constant user testing. C/C++, Perl, and Python developers can also experiment with JXTA, using the corresponding implementation. The best way to start with any open-source "platform" project such as JXTA is to take a look at what others are doing with the platform.

A Treasure Trove of Innovations: JXTA Projects

While the killer application that will justify the wildfire deployment of P2P technology has yet to be created, there is no shortage of innovative new applications that use JXTA technology. A survey of the ongoing projects at www.jxta.org provides a glimpse of the future of P2P networked solutions.

P2P Communications and Resource Sharing

The first substantial JXTA example application, called myJXTA (instantp2p.jxta.org), combines secured instant messaging, file sharing, and group chat, all in one application. It even has an enterprise version spin-off (myjxta2.jxta.org) that is very easy to use, with a "cool look" GUI. The myJXTA applications leverage the decentralized point-to-point and multipoint (group) messaging capabilities of JXTA over P2P networks, combining powerful network collaboration tools in a simple and user friendly interface. There are New hot app: Facebook Albums To PDF open in browser PRO version Are you a developer? Try out the HTML to PDF API


downloadable binaries that you can deploy immediately, and enjoy secured P2P instant messaging, file sharing, and group chat within your organization.

Collaboration Over P2P Networks

Leveraging P2P for collaboration, the Edutella project (edutella.jxta.org) is implementing a P2P network for the exchange of educational resources between German universities (including Hannover, Braunschweig, and Karlsruhe), Swedish universities (including Stockholm and Uppsala), Stanford University, and others. Another collaboration project called whiteboard (whiteboard.jxta.org) aims to provide whiteboard sharing capabilities over a P2P.

Multimedia P2P
On the multimedia front, software engineers in the vop2p project (vop2p.jxta.org) are busy experimenting with the possibility of building a decentralized phone network over P2P. If this works out, one could potentially operate a voice or videophone network without the need for a centralized phone company. The only requirement will be a critical mass of users on the network, each bringing their own bandwidth and computing power. Another project, radioJXTA (radiojxta.jxta.org) attempts to leverage the work of vop2p, and use it for audio delivery over P2P networks. Both of these projects build on the propagation pipe and streaming transport work being done in the JXTA wire project (wire.jxta.org).

Relieving Internet Bottlenecks

When the Open Office (www.openoffice.org) folks ran into download bottleneck problems due to high demand for their products, they turned to P2P and JXTA for help. The result is a project called Oopster (oopster.jxta.org). Oopster aims to provide a solution for the distribution of large and high-demand content. Oopster provides distributed and redundant storage for these high-demand files (throughout the P2P network) and a "distributed chunked download" algorithm that enables different portions of the same file to be retrieved from different peers on the network.

Gaming over P2P Networks

For gamers, JXTA chess (chess.jxta.org) lets you play or watch a game of chess over P2P networks. Another gaming project, called go (go.jxta.org), aims to extend single-opponent game playing into a distributed league and tournament gaming framework. Go also explores the possibility of capturing collective player wisdom and intelligence within a P2P network -- potentially creating a formidable computer opponent for the game.

Software Development: P2P Style

For software developers, project brando (brando.jxta.org) is researching a completely distributed code sharing, maintenance, and revision control system; and a project called easy entry library (ezel.jxta.org) aims to provide a foundation library to simplify JXTA programming.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

New hot app: Facebook Albums To PDF


Mobile and Embedded P2P

For mobile computing, the folks responsible for the JXTA implementation for the J2ME platform (jxme.jxta.org) are working diligently on JXTA-enabling PDAs, cellphones, and almost any new mobile gadget. In fact, several JXTA applications (for example, myJXTA) already run on these resource-limited mobile devices. Another fascinating project, which is leveraging the work of the JXME project, aims to create "JXTA-on-a-stick." This project is called TINI (tini.jxta.org), named after the hardware it runs on from Dallas Semiconductor. TINI already delivers a complete P2P network node, JXTA-enabled, on a low-power, ready-to-be-embedded circuit board. While some of these projects are works-in-progress, many of them provide working code that you can use today. Review these applications, and think about how you (or your organization) can profit from the deployment of JXTA P2P technology.

Making Money with JXTA

P2P technologies such as JXTA can eliminate the need for expensive centralized infrastructures, but what does that mean to the rest of your organization's bottom line? P2P requires a different way of thinking than the more familiar client-server solutions, so how does the application vendor/developer make money? What's the business case for JXTA?

Cost Savings: Peer-to-Peer Thinking

The first place to look for opportunity is where you're working now. Think about what you already develop, and imagine how your applications could work with JXTA. Calculate the cost of the infrastructure, bandwidth, and support required from the traditional solution. Then look at JXTA, with less centralized infrastructure required. You can quickly see how much you can save. Remember that your infrastructure costs money to operate every hour of the day. Don't be afraid to calculate the costs for the next ten years. Model your client server and web-based solutions (using JXTA) by thinking of your solution as a large cluster of smaller, decentralized servers and clients. Data is stored on the client where it is needed, rather than collected all in one place. In P2P, the client is also a server, and it shares its data and processing with others. Refactoring is an effort, but the cost of redesign creates huge savings in infrastructure. There are also things that P2P can do that centralized solutions can't do very well. For example, it's relatively easy to create services that can are robust, scalable, and fault tolerant using a P2P network, since these are intrinsic qualities of P2P. Applications can also take advantage of the local CPU, storage, and other resources -- including users, with their particular knowledge and skills).

A Server in P2P Land

Should you remove the server completely? First, realize that there are still many reasons for server-side New hot app: Facebook Albums To PDF open in browser PRO version Are you a developer? Try out the HTML to PDF API


Should you remove the server completely? First, realize that there are still many reasons for server-side functionality. For example, credit cards still need central processing. The key is to offload most of the application to the peers and decentralize interactions as much as possible. Web services via SOAP are ideal for the integration of peers and servers. Servers can act as authoritative repositories and access points for data, authentication, or interaction with legacy software. If you had a distributed database hosted by peers, the server could fill in the gaps of data that has not saturated the peer network. For eCommerce, the server transacts the purchase rather than the catalog and the shopping cart. P2P integrated with servers translates to a significant cost savings, as compared to servers alone.

JXTA-Specific Opportunities
As with any technology, there are ways to make money through value-added and support channels. JXTA is an open standard and open source, so creating improved implementations is fair game. As JXTA becomes popular, developers will need documentation, development services, code libraries, tools, and training. Independent software vendors, individual consultants, and developers stand to profit from this increased demand. JXTA is also a group of services that can be embedded or integrated into hardware. The leap to putting JXTA into hardware is obvious and has many advantages. Imagine routers, firewalls, and proxy servers specifically designed for JXTA P2P-networking protocols. Manageable JXTA networks -- like today's managed networking equipment -- should sell readily into the corporate and ISP market. P2P has been seen as disruptive and uncontrollable by some network administrators, so a "managed solution" could be a winner. Giving corporations control over P2P will also legitimize its use behind and through the firewall.

How Big Is the JXTA Market?

How big will the JXTA market be? Forrester Research and Gartner are both predicting a greater acceptance of P2P applications, with most home users using P2P in just a few years. There are already more than 10,000 developers registered with Project JXTA, and more are discovering JXTA every day. The technology is being accepted worldwide by developers in the USA, Europe, and Asia. Most of this growth is happening through word-of-mouth rather than from press hype. Multiple researchers claim two key factors are driving this trend: Low cost and a higher level of interaction between users. Interaction between users is simplistic, given the instant messaging qualities of P2P. JXTA, with its generic infrastructure (unlike proprietary P2P technology) is easier for developers to apply to a wider set of applications. By eliminating some of the infrastructure, data centers, and the cost of bandwidth, the lower cost is obvious. JXTA is an enabling technology, whose impact should be similar to the first personal computers. Before the PC, a small computer cost tens or hundreds of thousands of dollars -- and filled a room. Innovation was limited to the few large companies that could afford and maintain these costly beasts. When the PC was

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

New hot app: Facebook Albums To PDF


introduced, there was an explosive increase in applications built by individual programmers and small companies, simply because the price was in range of these developers. The Internet started out to be a similar enabler, but the server approach dominated and reduced individual innovation because of the cost of delivering applications. The cost of infrastructure -- as well as the bandwidth necessary to deliver applications to thousands of users -- are out of the range of small developers, just like the mainframes of the past. With JXTA, the power is back in the hands of individual developers and small companies. As the growth of the PC market has shown, there's a lot of opportunity when everyone can afford to participate.

Next Steps: Where Do We Go From Here?

Now that you've learned about the potential of JXTA, you've probably already got a killer application in mind. So where do you go from here? Project JXTA has assembled a number of resources you can use to understand and leverage JXTA as quickly as possible, including:

Reference implementations: Project JXTA has a Java reference implementation available from download.jxta.org, and is currently working to add reference implementations in other common languages, including C, Objective C, Perl, Ruby, and Python. Though the Java implementation is the most complete implementation of the JXTA protocols, the C implementation (available for both Win32 and Linux) is fast approaching the same level of completeness. Protocol specifications: A detailed description of JXTA protocols is available at spec.jxta.org to allow you to dive deeper into the specifics of the protocols. This project (within Project JXTA) is documenting the JXTA standard, as part of current plans to submit the protocols to the Internet Engineering Task Force for standardization. Mailing lists: Project JXTA hosts a number of mail lists to help new and experienced developers alike understand how to use JXTA and the reference implementations. Most popular are user@jxta.org, dev@jxta.org, and discuss@jxta.org, which host discussions for JXTA newbies, experienced JXTA developers, and general discussions about JXTA and P2P, respectively.
JXTA is constantly evolving as developers augment the existing reference implementations and specification to address new requirements for the next generation of P2P applications. The responsibility now lies with developers, who, by creating exciting new business applications on top of JXTA, will show that P2P has matured . Good luck, and happy coding!

About the Authors

Daniel Brookshier is an independent consultant, speaker, and the author of JXTA: Java-P2P Programming from Sams Publishing. You can find Daniel's JXTA home page at people.jxta.org/turbogeek/, filled with

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

New hot app: Facebook Albums To PDF


examples and ideas about creating JXTA applications. Sing Li is the author of Early Adopter JXTA from Wrox Press, an easy-to-read guide for traditional client/server developers experimenting with P2P technology. He also started the vop2p project (vop2p.jxta.org/), an experimental attempt to replace the conventional phone network with a P2P-based network. Brendon Wilson is a Senior Software Engineer at PKI Innovations (www.pk3i.com) and author of JXTA, a book from New Rider Press. Brendon and his publisher have also graciously made the complete text of the book and its source code available on-line for the benefit of the JXTA community: www.brendonwilson.com/projects/jxta.

See Also
Project JXTA JXTA Protocol Specification JXTA books by the authors, and many more
Have a question about Java programming? Use Java Online Support.

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.

About Sun | About This Site | Newsletters | Contact Us | Employment | How to Buy | Licensing | Terms of Use | Privacy | Trademarks

A Sun Developer Network Site Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. Sun Developer RSS Feeds

2010, Oracle Corporation and/or its affiliates

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

New hot app: Facebook Albums To PDF