28.4. Distributed Garbage Collection (STABLE)

In a JGroups cluster, all nodes must store all messages received for potential re-transmission in case of a failure. However, if we store all messages forever, we will run out of memory. The distributed garbage collection service periodically purges messages that have been seen by all nodes, removing them from the memory in each node. The distributed garbage collection service is configured in the pbcast.STABLE sub-element under the JGroups config element. Here is an example configuration.
<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 intervals (in milliseconds) of garbage collection runs. Set this to 0 to disable interval-based garbage collection.
  • max_bytes specifies the maximum number of bytes received before the cluster triggers a garbage collection run. Set to 0 to disable garbage collection based on the bytes received.
  • stability_delay specifies the maximum time period (in milliseconds) of a random delay introduced before a node sends its STABILITY message at the end of a garbage collection run. The delay gives other nodes concurrently running a STABLE task a chance to send first. 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.