Write request in Cassandra?

2015-08-21 Thread ibrahim El-sanosi
Dear folks,


I have doubt on how Cassandra performs a write request; I have two
scenarios, please read them and ensure which one is correct?


Assume we have cluster consists of 4 nodes N1, N2, N3, and N4. As Cassandra
distributes the nodes in ring topology, the nodes links as following:

N--N--N3--N4--N1

Also we have replication factor equal to 3 (RF=3), and consistency level
equals to ALL (CL=ALL).

Client sends write request, W, to coordinator, say N4. The partitioner has
determined the primary node of W is N1.

What will happen now?


*Scenario 1**:* coordinator sends W to N1. Upon receiving W, N1 stores it
locally (in commitLog and memtable, *please forget about internal process*)
and acknowledges the coordinator N4. Then N1 sends a copy of W to N2
(because N2 is next node in ring from N1 prospective). Upon receiving W, N2
stores it locally and sends acknowledgement to N4. Then N2 sends a copy of
W to N3 (because N3 is next node in ring from N2 prospective). Upon
receiving W, N3 stores it locally and acknowledges the Coordinator N4.
Finally as soon as coordinator, N4, receives an acknowledgement from all
nodes (N1, N2, and N3), it replays to the client.

Note that: if scenario 1 correct, then the latency will be 4 rounds (N4--N1
--N2--N3--N4 client).



*Scenario 2:*  coordinator, N4, broadcasts W to N1, N2, and N3 (N4--N1, N4
--N2, N4--N3). Then replicas (N1, N2, and N3) store W locally and
acknowledge to N4.  When N4 receives all ACKs, it replays to client.



Can anyone confirm which scenario is correct in Cassandra?



Regards?



Ibrahim


Re: Write request in Cassandra?

2015-08-21 Thread Laing, Michael
https://academy.datastax.com/courses/ds201-cassandra-core-concepts/internal-architecture-replication

On Fri, Aug 21, 2015 at 11:53 AM, Laing, Michael michael.la...@nytimes.com
wrote:

 2 is more correct.

 On Fri, Aug 21, 2015 at 11:48 AM, ibrahim El-sanosi 
 ibrahimsaba...@gmail.com wrote:

 Dear folks,


 I have doubt on how Cassandra performs a write request; I have two
 scenarios, please read them and ensure which one is correct?


 Assume we have cluster consists of 4 nodes N1, N2, N3, and N4. As
 Cassandra distributes the nodes in ring topology, the nodes links as
 following:

 N--N--N3--N4--N1

 Also we have replication factor equal to 3 (RF=3), and consistency level
 equals to ALL (CL=ALL).

 Client sends write request, W, to coordinator, say N4. The partitioner
 has determined the primary node of W is N1.

 What will happen now?


 *Scenario 1**:* coordinator sends W to N1. Upon receiving W, N1 stores
 it locally (in commitLog and memtable, *please forget about internal
 process*) and acknowledges the coordinator N4. Then N1 sends a copy of W
 to N2 (because N2 is next node in ring from N1 prospective). Upon receiving
 W, N2 stores it locally and sends acknowledgement to N4. Then N2 sends a
 copy of W to N3 (because N3 is next node in ring from N2 prospective). Upon
 receiving W, N3 stores it locally and acknowledges the Coordinator N4.
 Finally as soon as coordinator, N4, receives an acknowledgement from all
 nodes (N1, N2, and N3), it replays to the client.

 Note that: if scenario 1 correct, then the latency will be 4 rounds (N4
 --N1--N2--N3--N4 client).



 *Scenario 2:*  coordinator, N4, broadcasts W to N1, N2, and N3 (N4--N1,
 N4--N2, N4--N3). Then replicas (N1, N2, and N3) store W locally and
 acknowledge to N4.  When N4 receives all ACKs, it replays to client.



 Can anyone confirm which scenario is correct in Cassandra?



 Regards?



 Ibrahim





Re: Write request in Cassandra?

2015-08-21 Thread Panagiotis Garefalakis
Definitely 2:

https://wiki.apache.org/cassandra/ArchitectureInternals
http://www.slideshare.net/grro/cassandra-by-example-the-path-of-read-and-write-requests

On Fri, Aug 21, 2015 at 4:54 PM, Laing, Michael michael.la...@nytimes.com
wrote:


 https://academy.datastax.com/courses/ds201-cassandra-core-concepts/internal-architecture-replication

 On Fri, Aug 21, 2015 at 11:53 AM, Laing, Michael 
 michael.la...@nytimes.com wrote:

 2 is more correct.

 On Fri, Aug 21, 2015 at 11:48 AM, ibrahim El-sanosi 
 ibrahimsaba...@gmail.com wrote:

 Dear folks,


 I have doubt on how Cassandra performs a write request; I have two
 scenarios, please read them and ensure which one is correct?


 Assume we have cluster consists of 4 nodes N1, N2, N3, and N4. As
 Cassandra distributes the nodes in ring topology, the nodes links as
 following:

 N--N--N3--N4--N1

 Also we have replication factor equal to 3 (RF=3), and consistency level
 equals to ALL (CL=ALL).

 Client sends write request, W, to coordinator, say N4. The partitioner
 has determined the primary node of W is N1.

 What will happen now?


 *Scenario 1**:* coordinator sends W to N1. Upon receiving W, N1 stores
 it locally (in commitLog and memtable, *please forget about internal
 process*) and acknowledges the coordinator N4. Then N1 sends a copy of
 W to N2 (because N2 is next node in ring from N1 prospective). Upon
 receiving W, N2 stores it locally and sends acknowledgement to N4. Then N2
 sends a copy of W to N3 (because N3 is next node in ring from N2
 prospective). Upon receiving W, N3 stores it locally and acknowledges the
 Coordinator N4. Finally as soon as coordinator, N4, receives an
 acknowledgement from all nodes (N1, N2, and N3), it replays to the client.

 Note that: if scenario 1 correct, then the latency will be 4 rounds (N4
 --N1--N2--N3--N4 client).



 *Scenario 2:*  coordinator, N4, broadcasts W to N1, N2, and N3 (N4--N1,
 N4--N2, N4--N3). Then replicas (N1, N2, and N3) store W locally and
 acknowledge to N4.  When N4 receives all ACKs, it replays to client.



 Can anyone confirm which scenario is correct in Cassandra?



 Regards?



 Ibrahim






Re: Write request in Cassandra?

2015-08-21 Thread Laing, Michael
2 is more correct.

On Fri, Aug 21, 2015 at 11:48 AM, ibrahim El-sanosi 
ibrahimsaba...@gmail.com wrote:

 Dear folks,


 I have doubt on how Cassandra performs a write request; I have two
 scenarios, please read them and ensure which one is correct?


 Assume we have cluster consists of 4 nodes N1, N2, N3, and N4. As
 Cassandra distributes the nodes in ring topology, the nodes links as
 following:

 N--N--N3--N4--N1

 Also we have replication factor equal to 3 (RF=3), and consistency level
 equals to ALL (CL=ALL).

 Client sends write request, W, to coordinator, say N4. The partitioner has
 determined the primary node of W is N1.

 What will happen now?


 *Scenario 1**:* coordinator sends W to N1. Upon receiving W, N1 stores it
 locally (in commitLog and memtable, *please forget about internal process*)
 and acknowledges the coordinator N4. Then N1 sends a copy of W to N2
 (because N2 is next node in ring from N1 prospective). Upon receiving W, N2
 stores it locally and sends acknowledgement to N4. Then N2 sends a copy of
 W to N3 (because N3 is next node in ring from N2 prospective). Upon
 receiving W, N3 stores it locally and acknowledges the Coordinator N4.
 Finally as soon as coordinator, N4, receives an acknowledgement from all
 nodes (N1, N2, and N3), it replays to the client.

 Note that: if scenario 1 correct, then the latency will be 4 rounds (N4--
 N1--N2--N3--N4 client).



 *Scenario 2:*  coordinator, N4, broadcasts W to N1, N2, and N3 (N4--N1,
 N4--N2, N4--N3). Then replicas (N1, N2, and N3) store W locally and
 acknowledge to N4.  When N4 receives all ACKs, it replays to client.



 Can anyone confirm which scenario is correct in Cassandra?



 Regards?



 Ibrahim