Database Reference
In-Depth Information
ColumnFamily Cache Tuning
There are four possible settings for caching within a ColumnFamily: ALL , NONE ,
KEYS_ONLY , and ROWS_ONLY . They all do exactly what they sound as if they
do. NONE is to disable caching on the ColumnFamily. KEYS_ONLY is to cache
only by keys requested. ROWS_ONLY is to cache the entire row of a requested
key. ALL refers to the ability to cache as much information as possible. The option
that you choose should be relevant to the workload that you normally put on Cas-
sandra.
A good way to think about this is to look at your query pattern. If you have
skinny rows and you are asking Cassandra for the same row over and over, us-
ing ROWS_ONLY is likely the route for you. It allows the row to be put into the
cache and modified only if the row itself is modified. If you have wide rows
and you don't use most of the keys in the row, it might make more sense to use
KEYS_ONLY as the cache. Using KEYS_ONLY makes sense only if you don't
have a lot of turnover in the cache. If you do have a lot of turnover, it may make
sense not to do any caching at all. This means setting the cache to NONE . Listing
6.2 shows how to change the cache setting on the events table to KEYS_ONLY us-
ing CQL 3.
Listing 6.2 Change the Cache Setting on an Existing Table
Click here to view code image
# ALTER TABLE events WITH caching='KEYS_ONLY';
Bloom Filters
Bloom filters are a space-efficient probabilistic data structure that allows you to
test whether or not an element is a member of a set. Bloom filters allow for false
positives, but not for false negatives. Cassandra uses these data structures to de-
termine whether or not an SSTable has data for a particular row. They are used
only in index queries, not in range queries.
Since by definition bloom filters allow you to customize the level of accuracy
of your data structure, Cassandra passes that ability along to you. If you set the
bloom_filter_fp_chance high, the bloom filter will use less memory but
will require more disk I/O. You can disable bloom filters completely if you set the
bloom_filter_fp_chance to 1.0.
 
Search WWH ::




Custom Search