JBoss.org Community Documentation
In the unfortunate event of an instance crashing, it is assumed that the client connecting to the cache (directly or indirectly, via some other service such as HTTP session replication) is able to redirect the request to any other random cache instance in the cluster. This is where a concept of Data Gravitation comes in.
Data Gravitation is a concept where if a request is made on a cache in the cluster and the cache does not contain this information, it asks other instances in the cluster for the data. In other words, data is lazily transferred, migrating only when other nodes ask for it. This strategy prevents a network storm effect where lots of data is pushed around healthy nodes because only one (or a few) of them die.
If the data is not found in the primary section of some node, it would (optionally) ask other instances to check in the backup data they store for other caches. This means that even if a cache containing your session dies, other instances will still be able to access this data by asking the cluster to search through their backups for this data.
Once located, this data is transferred to the instance which requested it and is added to this instance's data tree. The data is then (optionally) removed from all other instances (and backups) so that if session affinity is used, the affinity should now be to this new cache instance which has just taken ownership of this data.
Data Gravitation is implemented as an interceptor. The following (all optional) configuration properties pertain to data gravitation.
dataGravitationRemoveOnFind
- forces all remote caches that own the data or hold backups for the data to remove that data,
thereby making the requesting cache the new data owner. This removal, of course, only happens
after the new owner finishes replicating data to its buddy. If set to
false
an evict is broadcast instead of a remove, so any state persisted in cache loaders will remain.
This is useful if you have a shared cache loader configured. Defaults to
true
.
dataGravitationSearchBackupTrees
- Asks remote instances to search through their backups as well as main data trees. Defaults to
true
. The resulting effect is that if this is
true
then backup nodes can respond to data gravitation requests in addition to data owners.
autoDataGravitation
- Whether data gravitation occurs for every cache miss. By default this is set to
false
to prevent unnecessary network calls. Most use cases will know when it may need to gravitate
data and will pass in an
Option
to enable data gravitation on a per-invocation basis. If
autoDataGravitation
is
true
this
Option
is unnecessary.