23.4. Distributed Garbage Collection (STABLE)

In a JGroups cluster, all nodes must store all messages received for potential retransmission in case of a failure. However, if we store all messages forever, we will run out of memory. The distributed garbage collection service in JGroups periodically purges messages that have seen by all nodes from the memory in each node. The distributed garbage collection service is configured in the pbcast.STABLE sub-element under the JGroups Config element, like so:
<pbcast.STABLE stability_delay="1000"
    desired_avg_gossip="5000" 
    max_bytes="400000"/>
The configurable attributes in the pbcast.STABLE element are as follows.
desired_avg_gossip
Specifies the interval (in milliseconds) between garbage collection runs. Setting this parameter to 0 disables this service.
max_bytes
Specifies the maximum number of bytes to receive before triggering a garbage collection run. Setting this parameter to 0 disables this service.

Note

Set max_bytes when you have a high-traffic cluster.
stability_delay
Specifies the delay period before a STABILITY message is sent. If used together with max_bytes, this attribute should be set to a small number.

Note

Set the max_bytes attribute when you have a high traffic cluster.