You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by mfronczyk <fr...@gmail.com> on 2015/09/11 23:14:08 UTC

Persistent CacheStore and backups.

When a CacheStore in the write-behind mode is used with backup copies, does
writing happen on the primary node only, or on the backups as well, meaning
that the same value might be persisted multiple times?





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Persistent-CacheStore-and-backups-tp1368.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Persistent CacheStore and backups.

Posted by vkulichenko <va...@gmail.com>.
mfronczyk wrote
> Can I make transaction writes to the persistence store atomic with
> write-behind? As you wrote, writes always happen on the primary node when
> write-behind is enabled. This means that if there were multiple keys
> modified in a single transaction and these keys belong to different
> primary nodes, the persistent store might get into an inconsistent state
> if any of the nodes fails to persist the change. Is that true?

Yes, this is true. Write-behind updates are asynchronous and are never
enlisted in the transaction. So even if all of them happen on one node,
there is a chance to have data inconsistency between cache and database (but
not within the cache). If you want to have database to be always consistent
with the cache, you will have to use write-through and therefore update DB
synchronously.

mfronczyk wrote
> My dataset is relatively small, about 16GB, so I can easily hold it in a
> single machine's RAM. I want to have a cluster of 2 nodes - master and
> slave for data safety and write-behind for performance. I require data
> consistency more than availability.  I'm wondering if it's possible to
> configure Ignite to treat one node as the primary node for all map entries
> and the 2nd one for backups. Then only one node will be writing to the
> persistent store with write-behind enabled, so it'll always remain
> consistent. I was hoping that REPLICATED mode allows that, but it seems
> that it'll still distribute the entries over the 2 nodes. Do you have any
> ideas?

What you're describing is actually a single-partition cache and you can
achieve this configuring affinity like this:

<property name="affinity">
    <bean
class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
        <property name="partitions" value="1"/>
    </bean>
</property>

But again, this does not guarantee transactional consistency between cache
and DB in case of write-behind, so I don't see any benefits in this
approach.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Persistent-CacheStore-and-backups-tp1368p1556.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Persistent CacheStore and backups.

Posted by mfronczyk <fr...@gmail.com>.
It seems that custom affinity mapping might help here - setting the same
affinity key for all entries should guarantee that all keys go to a single
node. Is that right? Are there any drawbacks of that?

Is it possible to control which node owns the data?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Persistent-CacheStore-and-backups-tp1368p1548.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Persistent CacheStore and backups.

Posted by mfronczyk <fr...@gmail.com>.
Can I make transaction writes to the persistence store atomic with
write-behind? As you wrote, writes always happen on the primary node when
write-behind is enabled. This means that if there were multiple keys
modified in a single transaction and these keys belong to different primary
nodes, the persistent store might get into an inconsistent state if any of
the nodes fails to persist the change. Is that true?

My dataset is relatively small, about 16GB, so I can easily hold it in a
single machine's RAM. I want to have a cluster of 2 nodes - master and slave
for data safety and write-behind for performance. I require data consistency
more than availability.  I'm wondering if it's possible to configure Ignite
to treat one node as the primary node for all map entries and the 2nd one
for backups. Then only one node will be writing to the persistent store with
write-behind enabled, so it'll always remain consistent. I was hoping that
REPLICATED mode allows that, but it seems that it'll still distribute the
entries over the 2 nodes. Do you have any ideas?

As a bonus, I'd like to control which of the nodes holds the primary entries
so I can embed all processing on that node in order to minimise the latency.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Persistent-CacheStore-and-backups-tp1368p1547.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Persistent CacheStore and backups.

Posted by vkulichenko <va...@gmail.com>.
mfronczyk wrote
> When a CacheStore in the write-behind mode is used with backup copies,
> does writing happen on the primary node only, or on the backups as well,
> meaning that the same value might be persisted multiple times?

Write to persistence store happens once for each update, regardless of cache
mode and number of backups.

In case of write-behind it always happens on primary node. In case of
write-through it depends on atomicity mode: ATOMIC cache will call the store
from primary node as well, but TRANSACTIONAL cache will call the store from
the node that initiated the update (or transaction).

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Persistent-CacheStore-and-backups-tp1368p1369.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.