Cluster Client Consistency¶
Info
Cluster client consistency only matters when the cluster client holds a copy of all (or a subset) of the cluster data in its own process space, and uses that data to make any decisions or to respond directly to its clients.
Aeron Cluster does not enforce any particular type of consistency in Aeron Cluster clients — it is up to the developer to build what is appropriate. Mechanisms for two levels of client held data consistency are shown below - but these are not the only options. Multiple levels of consistency can be used within the same cluster, with the cluster client able to make decisions on which approach to take on a request by request basis.
- eventual consistency - the cluster clients can respond with stale data.
- strong consistency - the cluster clients never respond with stale data.
Preconditions¶
In the two cases below, the cluster is assumed to have the following capabilities added by the developer
- an external
Admin
process is responsible for sending in commands to update the data in question - once the
Admin
process submits commands updating the data, the cluster immediately forwards the data onto the cluster clients - the updated data is moved over the Aeron Cluster client communications and not an independent channel.
Note that the Admin
process is itself a standard Aeron Cluster client process.
Eventual Consistency¶
In the eventual consistency model, the cluster client receives updates to the data asynchronously and responds immediately to its clients requests. In this scenario, the data can be incorrect for short periods of time while it is being replicated from the cluster to cluster clients.
Strong Consistency¶
In the strong consistency model, the cluster client sequences requests from its client via the cluster.
It does this by taking the client request, adding it as a payload to some form of sequenceThis
message, and then only responding to its client once the cluster responds to the sequenceThis
with a sequenced
message.
As long as the cluster sends data synchronously on each update to the cluster clients, then the cluster client will not send stale data.