Tuesday, February 21, 2017

JGroups 4.0.0.Final

I'm happy to announce that JGroups 4.0.0.Final is out!

With 120+ issues, the focus of this version is API changes, the switch to Java 8 and thus the use of new language features (streams, lambdas) and optimizations.

API changes

Fluent configuration

JChannel ch=new JChannel("config.xml").name("A").connect("cluster");

Removed deprecated classes and methods

Removed support for plain string-based channel configuration


Use of Java 8 features

E.g. replace Condition with Predicate etc

Removed classes

MessageDispatcher / RpcDispatcher changes

Use of CompletableFuture instead of NotifyingFuture

TCP: remove send queues

New features

Deliver message batches 


Receiver (ReceiverAdapter) now has an additional callback receive(MessageBatch batch). This allows JGroups to pass an entire batch of messages to the application rather than passing them up one by one.



Plus fixed security issues in the refactored code. Removed ENCRYPT.

Measure round-trip times for RPCs via probe


Keys 'rpcs' and 'rpcs-details' dump information about average RTTs between individual cluster members

Change message bundler at runtime


Message bundlers can be changed at runtime via probe. This is useful to see the effect of different bundlers on performance, even in the same test run.


DELIVERY_TIME: new protocol to measure delivery time in the application


Exposes stats via JMX and probe

RELAY2: sticky site masters


When we have multiple site masters, messages from the same member should always be handled by the same site master. This prevents reordering of messages at the receiver.

Multiple elements in bind_addr





This tries to bind to eth2 first, then to, then to an interface that starts with en0, and

finally to loopback.

Useful when running in an environment where the IP addresses and/or interfaces are not known before.

Multiple receiver threads in UDP


Multiple threads can receive (and process) messages from a datagram socket, preventing queue buildups.




RpcDispatcher: don't copy the first anycast


Reduction of memory size of classes

Remove one buffer copy in COMPRESS


Replace Java serialization with JGroups marshalling


Some internal classes still used Java serialization, which opens up security holes

(google 'java serialization vulnerability').

Faster marshalling / unmarshalling of messages

TCP: reduce blocking


Message bundler improvements


E.g. removal of SingletonAddress: not needed anymore as shared transports have been removed, too.

Protocol: addition of up(Message) and down(Message) callbacks


This massively reduces the number of Event creations.

TransferQueueBundler: remove multiple messages


Instead of removing messages one-by-one, the remover thread now removes as many messages as are in the queue (contention) into a local queue (no contention) and then creates and sends message batches off of the local queue.

Single thread pool


There's only a single thread pool for all typs of messages, reducing the maintenance overhead of 4 thread pools and the configuration required.

The internal thread pool is still available (size to the number of cores), but not configurable.
A ForkJoinPool can be used instead of the thread pool (which can be disabled as well).

Timer: tasks can indicate that they will not block


If a task calls execute() with an argument blocking==false, the task will be executed by the timer's main thread, and not be passed on to the timer's thread pool. This reduces the number of threads needed and therefore the number of context switches.

Headers are resized unnecessarily


ByteArrayDataOutputStream: expand more conservatively


Reading ints and longs creates unnecessary buffers


Ints and longs are read into a byte[] array first, then parsed. This was changed to read the values and add them to the resulting ints or longs.

Should reduce overall memory allocation as ints and longs are used a lot in headers.

Table.removeMany() creates unneeded temp list


This method is used a lot in NAKACK2 and UNICAST3. The change was to read messages directly into the resulting MessageBatch instead of a temp list and from there into the batch.

Reduce in-memory size of UnicastHeader3


Reduced size from 40 -> 32 bytes.

Cache result of log.isTraceEnabled()


This was done mainly for protocols where log.isTraceEnabled() was used a lot, such as TP, NAKACK2 or UNICAST3.

Note that the log level can still be changed at runtime.

Added MessageProcessingPolicy to define assigning of threads to messages or batches


This only applies only to regular (not OOB or internal) messages. Make sure that only one message per member is processed at a given time by the thread pool.

This reduces the number of threads needed.

UNICAST3 / NAKACK2: more efficient adding and removing of messages / batches to/from tables


Simpler algorithm and removal of one lock (= less contention)

Bug fixes

GMS sometimes ignores view bundling timeout


UFC and MFC headers get mixed up


Although indepent protocols, the protocol ID was assigned by the superclass, so replenish and credit messages would get mixed up, leading to stuttering in the sending of credits.

Flow control: replenish credits after message delivery


MERGE3: merge is never triggered


This is an edge case that was not covered before: every subgroup coordinator has some other member as coord:


MPING: restart fails


UNICAST3 drops all messages until it receives one with first==true


This caused a bug in ASYM_ENCRYPT.

ASYM_ENCRYPT: message batches are not handled correctly


SYM_ENCRYPT: allow for other keystores besides JCEKS


E.g. pcks#12 or jks

ASYM_ENCRYPT encrypts an empty buffer into a null buffer


This caused an NPE.


On Sourceforge: https://sourceforge.net/projects/javagroups/files/JGroups/4.0.0.Final,
or via Maven:

The manual is at http://www.jgroups.org/manual4/index.html.

The complete list of features and bug fixes can be found at 

Bela Ban, Kreuzlingen, Switzerland
March 2017

No comments:

Post a Comment