Search code examples
synchronizationigniteconsistency

Effect of WriteSynchronizationMode on write operations inside a transaction in Apache Ignite


WriteSynchronizationMode allows users to pick from 3 different synchronization modes (FULL_SYNC, FULL_ASYNC, PRIMARY_SYNC) when performing writes on a distributed setting.

Based on my understanding, when writing to the cache (whether inside or outside of a transaction) the user-perceived latency must be the same in the following two scenarios if the WriteSynchronizationMode is set to PRIMARY_SYNC:

  1. one-node cluster where only 1 primary copy of the data exits in a remote server.
  2. two-node cluster where 1 primary copy of the data resides on the remote server and a backup copy exists in the adjacent server.

In other words, the write latency should not be affected by the number of backup copies in PRIMARY_SYNC.

However, in my current experiments, I am facing different latencies for the above settings (3RTT for scenario #1 and 4RTT for scenario #2 ). Can someone please explain the reason?


Solution

  • When you use a transactional cache, then every write operation requires lock acquisition. It also involves communication with backup nodes. So, the more backups, the more time it takes to perform a transaction. And even if you don't run explicit transactions, then every write operation passes through this process.

    So, for a transactional cache I would expect a significant decrease of performance of write operations with growth of number of backups. You can find more information about work of transactional caches here: https://cwiki.apache.org/confluence/display/IGNITE/Ignite+Key-Value+Transactions+Architecture

    Try benchmarking atomic caches. You could still observe a performance drop, since synchronisation takes resources. But it won't be that big.