JGroups

Last updated
JGroups
Developer(s) Bela Ban
Stable release(s)
5.x5.1.6.Final / April 6, 2021;13 months ago (2021-04-06) [1]
4.x4.2.12.Final / April 1, 2021;13 months ago (2021-04-01) [1]
Repository github.com/belaban/JGroups
Written in Java
Operating system Cross-platform
Size 2.1 MB
Type reliable multicast system
License Apache License 2.0
Website www.jgroups.org

JGroups is a library for reliable one-to-one or one-to-many communication written in the Java language.

Contents

It can be used to create groups of processes whose members send messages to each other. JGroups enables developers to create reliable multipoint (multicast) applications where reliability is a deployment issue. JGroups also relieves the application developer from implementing this logic themselves. This saves significant development time and allows for the application to be deployed in different environments without having to change code.

Features

Code sample

This code below demonstrates the implementation of a simple command-line IRC client using JGroups:

publicclassChatextendsReceiverAdapter{privateJChannelchannel;publicChat(Stringprops,Stringname){channel=newJChannel(props).setName(name).setReceiver(this).connect("ChatCluster");}publicvoidviewAccepted(Viewview){System.out.printf("** view: %s\n",view);}publicvoidreceive(Messagemsg){System.out.printf("from %s: %s\n",msg.getSource(),msg.getObject());}privatevoidsend(Stringline){try{channel.send(newMessage(null,line));}catch(Exceptione){}}publicvoidrun()throwsException{BufferedReaderin=newBufferedReader(newInputStreamReader(System.in));while(true){System.out.print("> ");System.out.flush();send(in.readLine().toLowerCase());}}publicvoidend()throwsException{channel.close();}publicstaticvoidstart(Chatclient)throwsException{try{client.run();}catch(Exceptione){}finally{client.end();}}publicstaticvoidmain(String[]args)throwsException{Stringprops="udp.xml";Stringname;for(inti=0;i<args.length;i++){if(args[i].equals("-props")){props=args[++i];continue;}if(args[i].equals("-name")){name=args[++i];continue;}System.out.println("Chat [-props XML config] [-name name]");return;}start(newChat(props,name));}}

A JChannel is instantiated from an XML configuration (e.g. udp.xml). The channel is the endpoint for joining a cluster.

Next, the receiver is set, which means that two callbacks will be invoked:

Then, the channel joins cluster "ChatCluster". From now, messages can be sent and received, plus a new view (including this member) will be installed in all cluster members (including the newly joined member).

Anything typed in the main loop results in the creation of a message to be sent to all cluster members, including the sender.

Instances of the chat application can be run in the same process, on the same box, on different hosts in the local network, on hosts in different networks, or in the cloud. The code remains the same; only the configuration needs to be changed.

For example, in a local network, IP multicasting might be used. When IP multicasting is disabled, TCP can be used as transport. When run in the cloud, TCP plus a cloud discovery protocol would be used and so on...

Flexible protocol stack

The most powerful feature of JGroups is its flexible protocol stack, which allows developers to adapt it to exactly match their application requirements and network characteristics. The benefit of this is that you only pay for what you use. By mixing and matching protocols, various differing application requirements can be satisfied. JGroups comes with a number of protocols (but anyone can write their own), for example

Building blocks

Building blocks are classes layered over JGroups channels, which provide higher-level abstractions such as

Related Research Articles

Multicast Computer networking technique for transmission from one sender to multiple receivers

In computer networking, multicast is group communication where data transmission is addressed to a group of destination computers simultaneously. Multicast can be one-to-many or many-to-many distribution. Multicast should not be confused with physical layer point-to-multipoint communication.

In computer networking, the User Datagram Protocol (UDP) is one of the core members of the Internet protocol suite. With UDP, computer applications can send messages, in this case referred to as datagrams, to other hosts on an Internet Protocol (IP) network. Prior communications are not required in order to set up communication channels or data paths.

Transport layer Layer in the OSI and TCP/IP models providing host-to-host communication services for applications

In computer networking, the transport layer is a conceptual division of methods in the layered architecture of protocols in the network stack in the Internet protocol suite and the OSI model. The protocols of this layer provide end-to-end communication services for applications. It provides services such as connection-oriented communication, reliability, flow control, and multiplexing.

The Financial Information eXchange (FIX) protocol is an electronic communications protocol initiated in 1992 for international real-time exchange of information related to securities transactions and markets. With trillions of dollars traded annually on the NASDAQ alone, financial service entities are employing direct market access (DMA) to increase their speed to financial markets. Managing the delivery of trading applications and keeping latency low increasingly requires an understanding of the FIX protocol.

In computer science and networking in particular, a session is a time-delimited two-way link, a practical layer in the tcp/ip protocol enabling interactive expression and information exchange between two or more communication devices or ends – be they computers, automated systems, or live active users. A session is established at a certain point in time, and then ‘torn down’ - brought to an end - at some later point. An established communication session may involve more than one message in each direction. A session is typically stateful, meaning that at least one of the communicating parties needs to hold current state information and save information about the session history to be able to communicate, as opposed to stateless communication, where the communication consists of independent requests with responses.

BEEP Framework for creating network application protocols

The Blocks Extensible Exchange Protocol (BEEP) is a framework for creating network application protocols. BEEP includes building blocks like framing, pipelining, multiplexing, reporting and authentication for connection and message-oriented peer-to-peer (P2P) protocols with support of asynchronous full-duplex communication.

This article lists communication protocols that are designed for file transfer over a telecommunications network.

Ganglia (software)

Ganglia is a scalable, distributed monitoring tool for high-performance computing systems, clusters and networks. The software is used to view either live or recorded statistics covering metrics such as CPU load averages or network utilization for many nodes.

IP multicast is a method of sending Internet Protocol (IP) datagrams to a group of interested receivers in a single transmission. It is the IP-specific form of multicast and is used for streaming media and other network applications. It uses specially reserved multicast address blocks in IPv4 and IPv6.

In computer networking, a reliable protocol is a communication protocol that notifies the sender whether or not the delivery of data to intended recipients was successful. Reliability is a synonym for assurance, which is the term used by the ITU and ATM Forum.

A network socket is a software structure within a network node of a computer network that serves as an endpoint for sending and receiving data across the network. The structure and properties of a socket are defined by an application programming interface (API) for the networking architecture. Sockets are created only during the lifetime of a process of an application running in the node.

Transparent Inter Process Communication (TIPC) is an Inter-process communication (IPC) service in Linux designed for cluster-wide operation. It is sometimes presented as Cluster Domain Sockets, in contrast to the well-known Unix Domain Socket service; the latter working only on a single kernel.

Jakarta Mail is a Jakarta EE API used to send and receive email via SMTP, POP3 and IMAP. Jakarta Mail is built into the Java EE platform, but also provides an optional package for use in Java SE.

The Cajo Project is a framework that enables multiple Java applications that are spread across multiple machines to work together as one transparently and dynamically. This framework is useful for both open/free and proprietary applications that need distributed computing capabilities. It is capable of being used on almost any Java-equipped platform It is a “drop-in” framework, because it does not impose any structural requirements or source code changes and is 100% pure Java with no XML code. It also is not dependent on any other frameworks and can work behind NAT, firewalls, even HTTP proxies.

The Secure Real-Time Media Flow Protocol (RTMFP) is a protocol suite developed by Adobe Systems for encrypted, efficient multimedia delivery through both client-server and peer-to-peer models over the Internet. The protocol was originally proprietary, but was later opened up and is now published as RFC 7016.

A reliable multicast is any computer networking protocol that provides a reliable sequence of packets to multiple recipients simultaneously, making it suitable for applications such as multi-receiver file transfer.

Constrained Application Protocol (CoAP) is a specialized Internet application protocol for constrained devices, as defined in RFC 7252. It enables those constrained devices called "nodes" to communicate with the wider Internet using similar protocols. CoAP is designed for use between devices on the same constrained network, between devices and general nodes on the Internet, and between devices on different constrained networks both joined by an internet. CoAP is also being used via other mechanisms, such as SMS on mobile communication networks.

NACK-Oriented Reliable Multicast (NORM) is a transport layer Internet protocol designed to provide reliable transport in multicast groups in data networks. It is formally defined by the Internet Engineering Task Force (IETF) in Request for Comments (RFC) 5740, which was published in November 2009.

IDTP is a communication protocol to tracing messages of things identified by UTDIs (Utid), which adapt request/response model and like a hybrid of HTTP and Web Service but using JSON data format rather than XML format.

Network Device Interface (NDI) is a royalty-free software specification developed by NewTek to enable video-compatible products to communicate, deliver, and receive high-definition video over a computer network in a high-quality, low-latency manner that is frame accurate and suitable for switching in a live production environment.

References

  1. 1 2 "Releases · belaban/JGroups". github.com. Retrieved 2021-04-13.