Database Reference
In-Depth Information
The concept of weak and strong consistencies comes here. Weak consistency is when
reads may be wrong for a brief amount of time and strong consistency is when results are
always consistent. Basically, weak consistency sometimes returns inconsistent results. If
you have an N replica, to ensure that your reads always result in the latest value, you must
write and read from as many nodes that ensure at least one node overlaps. So, if you write
to W nodes and read from R nodes such that R+W > N, there must be at least one node
that is common in both read and write. And this will ensure that you have the latest data.
See the previous figure; ZERO and ANY consistency levels are weak consistency. ALL is
strong. ONE for read and ALL for write, or vice versa, will make a strongly consistent
system.
A system with QUORUM for both, read and write, is a strongly consistent system. Again,
the idea is to make sure that between the reads and the writes, at least one node overlaps.
While we are on this topic, it may be worth noticing that the higher the consistency level,
the slower the operation. So, if you want a super-fast write and a not-so-fast read, and you
also want the system to be strongly consistent, you can opt for consistency level ONE for
the writes and ALL for the reads.
LSM tree
Cassandra (and HBase) is heavily influenced by LSM tree. It uses an LSM tree-like mech-
anism to store data on a disk. The writes are sequential (in append fashion) and the data
storage is contiguous. This makes writes in Cassandra fast, because there is no disk-seek
involved. Contrast this with an RBDMS system that is based on the B+ tree ( ht-
tp://en.wikipedia.org/wiki/B%2B_tree ) implementation.
LSM tree advocates the following mechanism to store data: note down the arriving modi-
fication into a log file (commit log), push the modification/new data into memory
(MemTable) for faster lookup, and when the system has gathered enough updates in
memory, or after a certain threshold time, flush this data to a disk in a structured store file
(SSTable). The logs corresponding to the updates that are flushed can now be discarded.
LSM trees
Search WWH ::




Custom Search