2

I am new to Cassandra DB. I would like to know write sequence of Cassandra DB. Please clarify which approach Cassandra follow

Sequence Approach:

client -> Commit log -> Mem table -> response back to client

Parallel Approach:

Client -> ( commit and Mem table writes in parallel ) -> response back to client

Query: 1. if Cassandra follows sequence , how it will be fast as writing in two table sequence ?

  1. if Cassandra follows parallel, if write failure in commit or mem table what is response back to client.
vikrant rana
  • 4,509
  • 6
  • 32
  • 72
Gnana
  • 2,130
  • 5
  • 26
  • 57

1 Answers1

1

The Cassandra Write Path is through what you refer to as the Sequence Approach. Data is first persisted to the commit log (guaranteeing durability) and then to the mem table. Once it is written to the mem table, the coordinator node receives the OK from that node. Once the number of OKs matches the Consistency Level for the write, it sends back the OK to the client.

When the mem tables reach a certain size, data is flushed to disk in the form of SSTables.

gsteiner
  • 776
  • 5
  • 20
  • Thanks. what does **number of OKs matches Consistency Level for the write** mean ?. does it mean Replica factor node count. which one we use while creating key space. if yes, then client has to wait until all node write operation is done. if one node failure while write, what will happen ? please clarity – Gnana Aug 29 '16 at 20:42
  • Cassandra has a Consistency Level you specify on write and on read. It is basically the number of nodes you want to respond with the most current data before your client accepts that the query has been satisfied. If it's set to 2, it waits for 2 nodes to supply the data before getting the OK. You use consistency level and replication factor to guarantee consistency without having to get the data from all of the nodes. Here is a good StackOverflow that explains it in more detail. http://stackoverflow.com/questions/24587869/understand-cassandra-replication-factor-versus-consistency-level – gsteiner Aug 30 '16 at 12:52