Database Reference
In-Depth Information
Basic Read Properties
There are a few basic properties of reading data from Cassandra that are worth noting. First, it's
easy to read data because clients can connect to any node in the cluster to perform reads, without
having to know whether a particular node acts as a replica for that data. If a client connects to a
node that doesn't have the data it's trying to read, the node it's connected to will act as coordin-
ator node to read the data from a node that does have it, identified by token ranges.
To fulfill read operations, Cassandra does have to perform seeks, but you can speed these up
by adding RAM. Adding RAM will help you if you find the OS doing a lot of paging on reads
(in general, it is better to enable the various caches Cassandra has). Cassandra has to wait for a
number of responses synchronously (based on consistency level and replication factor), and then
perform read repairs as necessary.
So reads are clearly slower than writes, for these various reasons. The partitioner doesn't influ-
ence the speed of reads. In the case of range queries, using OPP is significantly faster because it
allows you to easily determine which nodes don'thave your data. The partitioner's responsibility
is to perform the consistent hash operation that maps keys to nodes. In addition, you can choose
row caching and key caching strategies to give you a performance boost (see Chapter 11 ) .
The API
This section presents an overview of the basic Cassandra API so that once we start reading and
writing data, some of these exotic terms won't seem quite so difficult. We already know what
a column, super column, and column family are: a column family contains columns or super
columns; a super column contains only columns (you can't nest one super column inside anoth-
er); and columns contain a name/value pair and a timestamp.
In a relational database, the terms SELECT, INSERT, UPDATE, and DELETE mean just what
they mean colloquially, in regular life. But working with Cassandra's API structures is not exactly
straightforward, and can be somewhat daunting to newcomers; after all, there's no such thing as
a “slice range” in regular life, so these terms may take some getting used to.
There are two basic concepts that you'll want to learn quickly: ranges and slices. Many queries
are defined using these terms, and they can be a bit confusing at first.
NOTE
Columns are sorted by their type (as specified by CompareWith ), and rows are sorted by their partition-
er.
Search WWH ::




Custom Search