

Release notes JGroups 4.0.0
===========================

Author: Bela Ban



API changes
===========
[https://issues.jboss.org/browse/JGRP-1605]

- Fluent configuration. Example:
  JChannel ch=new JChannel("config.xml").name("A").connect("cluster");
- Removed deprecated classes and methods


Remove support for plain string-based channel configuration
[https://issues.jboss.org/browse/JGRP-2019]


Use of Java 8 features
----------------------
[https://issues.jboss.org/browse/JGRP-2007]

E.g. replace Condition with Predicate etc


Removed classes
---------------
- Shared transport [https://issues.jboss.org/browse/JGRP-1844]
- TCP_NIO
- UNICAST, UNICAST2
- NAKACK
- PEER_LOCK
- FD_PING
- MERGE2
- FC
- SCOPE
- MuxRpcDispatcher
- ENCRYPT


MessageDispatcher / RpcDispatcher changes
-----------------------------------------
- [https://issues.jboss.org/browse/JGRP-1620]
- Use of CompletableFuture instead of NotifyingFuture

TCP: remove send queues
-----------------------
[https://issues.jboss.org/browse/JGRP-1994]






New features
============


Deliver message batches
-----------------------
[https://issues.jboss.org/browse/JGRP-2003]

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.


Refactored ENCRYPT into SYM_ENCRYPT and ASYM_ENCRYPT
----------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2021]

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


Measure round-trip times for RPCs via probe
-------------------------------------------
[https://issues.jboss.org/browse/JGRP-2049]

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


Change message bundler at runtime
---------------------------------
[https://issues.jboss.org/browse/JGRP-2058]

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.


Probe
-----

- Sort attributes for better legibility: https://issues.jboss.org/browse/JGRP-2066
- Removal of protocols via regular expressions


DELIVERY_TIME: new protocol to measure delivery time in the application
-----------------------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2101]

Exposes stats via JMX and probe


RELAY2: sticky site masters
---------------------------
[https://issues.jboss.org/browse/JGRP-2112]

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
------------------------------
[https://issues.jboss.org/browse/JGRP-2113]

E.g.

<TCP
    bind_addr="match-interface:eth2,10.5.5.5,match-interface:en*,127.0.0.1"
    ...
 />

This tries to bind to eth2 first, then to 10.5.5.5, 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
--------------------------------
[https://issues.jboss.org/browse/JGRP-2146]

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



FRAG3
-----
[https://issues.jboss.org/browse/JGRP-2154]





Optimizations
=============


RpcDispatcher: don't copy the first anycast
-------------------------------------------
[https://issues.jboss.org/browse/JGRP-2010]


Reduction of memory size of classes
-----------------------------------
- Rsp (32 -> 24 bytes): https://issues.jboss.org/browse/JGRP-2011
- Request: https://issues.jboss.org/browse/JGRP-2012


Remove one buffer copy in COMPRESS
[https://issues.jboss.org/browse/JGRP-2017]


Replace Java serialization with JGroups marshalling
---------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2033]

Some internal classes still used Java serialization, which opens up security holes
(google 'java serialization vulnerability').


Faster marshalling / unmarshalling of messages
----------------------------------------------
- Writing of headers: [https://issues.jboss.org/browse/JGRP-2042]
- Reading of headers: [https://issues.jboss.org/browse/JGRP-2043]


TCP: reduce blocking
--------------------
[https://issues.jboss.org/browse/JGRP-2053]


Message bundler improvements
----------------------------
[https://issues.jboss.org/browse/JGRP-2057]

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


Protocol: addition of up(Message) and down(Message) callbacks
-------------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2067]

This massively reduces the number of Event creations.


TransferQueueBundler: remove multiple messages
----------------------------------------------
[https://issues.jboss.org/browse/JGRP-2076]

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
------------------
[https://issues.jboss.org/browse/JGRP-2099]

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
--------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2100]

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
---------------------------------
[https://issues.jboss.org/browse/JGRP-2120]


ByteArrayDataOutputStream: expand more conservatively
-----------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2124]


Reading ints and longs creates unnecessary buffers
--------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2125]

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.removeMan() creates unneeded temp list
--------------------------------------------
[https://issues.jboss.org/browse/JGRP-2126]

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
---------------------------------------
[https://issues.jboss.org/browse/JGRP-2127]

Reduced size from 40 -> 32 bytes.


Cache result of log.isTraceEnabled()
------------------------------------
[https://issues.jboss.org/browse/JGRP-2130]

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
-----------------------------------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2143]

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
-------------------------------------------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2150]

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





Bug fixes
=========


GMS sometimes ignores view bundling timeout
-------------------------------------------
[https://issues.jboss.org/browse/JGRP-2028]


UFC and MFC headers get mixed up
--------------------------------
[https://issues.jboss.org/browse/JGRP-2072]

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
------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2084]


MERGE3: merge is never triggered
--------------------------------
[https://issues.jboss.org/browse/JGRP-2092]

This is an edge case that was not covered before: every subgroup coordinator has some other member as coord:
A: BAC
B: CAB
C: ABC



MPING: restart fails
--------------------
[https://issues.jboss.org/browse/JGRP-2116]



UNICAST3 drops all messages until it receives one with first==true
------------------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2131]

This caused a bug in ASYM_ENCRYPT.


ASYM_ENCRYPT: message batches are not handled correctly
-------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2149]


SYM_ENCRYPT: allow for other keystores besides JCEKS
----------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2151]

E.g. pcks#12 or jks


ASYM_ENCRYPT encrypts an empty buffer into a null buffer
--------------------------------------------------------
[https://issues.jboss.org/browse/JGRP-2153]

This caused an NPE.





Manual
======

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

The complete list of features and bug fixes can be found at http://jira.jboss.com/jira/browse/JGRP.


Bela Ban, Kreuzlingen, Switzerland
March 2017

