Search code examples
ignite

Apache IgniteCache Entry processor execution on Primary and replicas


Is there any possible way by which one can configure execution of CacheEntryProcessor as follows, EP should be executed on

  1. Only primary

  2. On primary as well as Replicas

I am aware that if I have ATOMIC cache, EP will only be executed only on the primary and only entry is sent to replicas, not EP.

But what I want is following

  • For read operations, EP should be executed only on Primary
  • For Write operations EP should be sent to primary as well as replicas ( not an entry but EP should be sent to replicas).

With TRANSACTIONAL cache, EP will be sent to primary as well as replicas, but for reading I want EP to execute only on Primary.

It is possible to achieve this on Apache IgniteCache.


Solution

  • Apache Ignite doesn't send a delta to backups (replica) nodes in ATOMIC mode. If EntryProcessor modifies entry then whole entry will be sent to backup nodes, not delta. When entry processor only read data ( doesn't invoke MutableEntry#setValue method) then EP won't be sent to backup nodes. This works by default for ATOMIC and TX cache modes.

    Any way, user's code should not depend from this behavior because it's details of implementation. It's the best practices.