You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by userx <ga...@gmail.com> on 2017/08/26 06:09:07 UTC

CacheMode - REPLICATED related questions

Hi,

Consider the following situation

Machine M1-> Data Grid Server S1
Machine M2-> Data Grid Server S2
Machine M3-> Data Grid Server S3

I intend to use REPLICATED mode because data loss is something which my
application can't take. 

QUESTIONS

QUESTION 1:
Is there a way, we can identify which out of the three machines will be the
PRIMARY mode ? And does it change w.r.t different clients, say if C1 is
doing put, the primary is M1 and if C2 is doing put the primary is M2. The
reason I am asking this question is if replication fails for C1 and say M1
goes down for some reason, then even if M2 and M3 are there, they are not
serving any purpose. 

QUESTION 2:
Can we configure or designate say M1 always to be primary ?

QUESTION 3:
We have one of the CacheWriteSynchronizationMode as PRIMARY_SYNC which means
that put operation will wait for data to be written on PRIMARY NODE (say
M1)? Is there a way that we ensure data to be replicated atleast 2 out of
the 3 machines listed. I could see the options as FULL_SYNC or PRIMARY_SYNC
so its either all of them or just the primary one.

QUESTION 4:
What happens if REPLICATION activity fails ? Is there any documentation for
the same as to what the cluster does in such cases or does client have to
take any actions on its part say log etc ?

QUESTION5:
I am soon going to enter production with Xmx as 1G and "Persistent Store
Enabled" to take care of data to be cached whose size > 1G. Your
https://apacheignite.readme.io/docs/preparing-for-production document has
mentioned the JVM related settings for a server with Xmx of 10G. Since I am
going with 1G, is there a documentation which helps me w.r.t recommended
settings on Xmx of 1g ?









--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CacheMode-REPLICATED-related-questions-tp16423.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: CacheMode - REPLICATED related questions

Posted by agura <ag...@apache.org>.
Answers for all your questions (except of 4th) here depend on cache write
synchronization mode. In case of FULL_SYNC mode the exception will be thrown
on the client and you will be able to catch and process it. For PRIMARY_SYNC
and FULL_ASYNC modes the client will get successful result and it's possible
in this case that data will be inconsistent between primary and backup.

So you should choose mode that provides required consistency guarantee for
you.

Your (1,1) entry will be available only if it was written to partition on
node. You can use readFromBackup flag in order to control partition type
that will be source for entry reading. So, for your use case every get
operation will return (1,1) entry after put operation if readFromBackup ==
false independently of synchronization mode.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CacheMode-REPLICATED-related-questions-tp16423p16452.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: CacheMode - REPLICATED related questions

Posted by userx <ga...@gmail.com>.
Hi Agura,
For QUESTION4 related to replication, I meant the following scenarios.

What does it mean for the clients which have done putAll operations 

1) While replicating from M1 to M2, there is a network glitch for say more
than joinTimeOutConfigured ?
2) M2 is shut down for some reason.
3) There is a RuntimeException while replication.
4) Say we intent to put 1,1 in a cache, If the cache is configured for a
REPLICATION mode then if the replication process is not completed whether
the sync mode is PRIMARY or FULL, is the entry 1,1 available to client for a
read even if it has not been replicated.

Do we have any unit tests available to cater to such scenarios on a local
node ?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CacheMode-REPLICATED-related-questions-tp16423p16451.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: CacheMode - REPLICATED related questions

Posted by agura <ag...@apache.org>.
Hi,

please see my answers (inlined)


userx wrote
> QUESTION 1:
> Is there a way, we can identify which out of the three machines will be
> the PRIMARY mode ? And does it change w.r.t different clients, say if C1
> is doing put, the primary is M1 and if C2 is doing put the primary is M2.
> The reason I am asking this question is if replication fails for C1 and
> say M1 goes down for some reason, then even if M2 and M3 are there, they
> are not serving any purpose. 

You can identify primary node only for a particular partition. Partitions
are evenly distributed among the nodes and for particular partition primary
and backup nodes will be always different. So there is no primary node for
all partitions. Affinity function is responsible for assigning primary or
backup nodes for each partition and you can't change this behavior
dynamically.


userx wrote
> QUESTION 2:
> Can we configure or designate say M1 always to be primary ?

You can't do it using backup filter that should be passed to
RendezvousAffinityFunction. But I don't think that it's good idea because
usually all request will be sent to the primary node and, in your case, only
one node will be under load while other will not.


userx wrote
> QUESTION 3:
> We have one of the CacheWriteSynchronizationMode as PRIMARY_SYNC which
> means that put operation will wait for data to be written on PRIMARY NODE
> (say M1)? Is there a way that we ensure data to be replicated atleast 2
> out of the 3 machines listed. I could see the options as FULL_SYNC or
> PRIMARY_SYNC so its either all of them or just the primary one.

There is no such possibility at present.


userx wrote
> QUESTION 4:
> What happens if REPLICATION activity fails ? Is there any documentation
> for the same as to what the cluster does in such cases or does client have
> to take any actions on its part say log etc ?

I'm afraid that I don't understand your question. Do you mean rebalancing
due to a node outage or data propagation to backups?


userx wrote
> QUESTION5:
> I am soon going to enter production with Xmx as 1G and "Persistent Store
> Enabled" to take care of data to be cached whose size > 1G. Your
> https://apacheignite.readme.io/docs/preparing-for-production document has
> mentioned the JVM related settings for a server with Xmx of 10G. Since I
> am going with 1G, is there a documentation which helps me w.r.t
> recommended settings on Xmx of 1g ?


It depends on your use cases and there are no any "silver bullet" like
advice. It would be great to test your application ander load before
production.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CacheMode-REPLICATED-related-questions-tp16423p16446.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.