[id='asynchronous-replication_{context}']
= Asynchronous replication

All clustered cache modes can be configured to use asynchronous communications with the
link:{configdocroot}[`mode="ASYNC"`]
attribute on the `<replicated-cache/>`, `<distributed-cache>`, or `<invalidation-cache/>`
element.

With asynchronous communications, the originator node does not receive any
acknowledgement from the other nodes about the status of the operation, so there is no
way to check if it succeeded on other nodes.

We do not recommend asynchronous communications in general, as they can cause
inconsistencies in the data, and the results are hard to reason about.
Nevertheless, sometimes speed is more important than consistency, and the option is
available for those cases.

[discrete]
== Asynchronous API
The Asynchronous API allows you to use synchronous communications,
but without blocking the user thread.

There is one caveat:
The asynchronous operations do NOT preserve the program order.
If a thread calls `cache.putAsync(k, v1); cache.putAsync(k, v2)`, the final value of `k`
may be either `v1` or `v2`.
The advantage over using asynchronous communications is that the final value can't be
`v1` on one node and `v2` on another.
