Database Reference
In-Depth Information
about the location of data in the SSTable. Each SSTable has one bloom filter and one in-
dex associated with it. The bloom filter helps Cassandra to quickly detect which SSTable
does not have the requested data, while the index helps to find the exact location of the
data in the SSTable file.
With this primer, we can start looking into how write and read works in Cassandra. We
will see more explanation later.
Write in action
To write, clients need to connect to any of the Cassandra nodes and send a write request.
This node is called the coordinator node . When a node in a Cassandra cluster receives a
write request, it delegates the write request to a service called StorageProxy . This
node may or may not be the right place to write the data. StorageProxy's job is to get the
nodes (all the replicas) that are responsible for holding the data that is going to be written.
It utilizes a replication strategy to do this. Once the replica nodes are identified, it sends
the RowMutation message to them, the node waits for replies from these nodes, but it
does not wait for all the replies to come. It only waits for as many responses as are enough
to satisfy the client's minimum number of successful writes defined by Consisten-
cyLevel .
Note
ConsistencyLevel is basically a fancy way of saying how reliable a read or write
you want to be. Cassandra has tunable consistency, which means you can define how
much reliability is wanted. Obviously, everyone wants a hundred percent reliability, but it
comes with latency as the cost. For instance, in a thrice-replicated cluster (replication
factor = 3), a write time consistency level TWO, means the write will become successful
only if it is written to at least two replica nodes. This request will be faster than the one
with the consistency level THREE or ALL, but slower than the consistency level ONE or
ANY.
The following figure is a simplistic representation of the write mechanism. The operations
on node N2 at the bottom represent the node-local activities on receipt of the write re-
quest:
Search WWH ::




Custom Search