Database Reference
In-Depth Information
Cache settings are mostly global as of Version 2.1.0. The settings can be altered in cas-
sandra.yaml . At table level, the only choices that you have are the cache type to use
with or if you should use any cache at all. The options are: keys only, rows only, both and
none. The following is an example (for more discussion, refer to the Creating a table sec-
tion in Chapter 3 , Effective CQL ):
CREATE TABLE users (
user_id uuid, email text,
password text,
PRIMARY KEY (user_id)
)
WITH
caching = {
'keys' : 'ALL',
'rows_per_partition' : '314'
};
The following are the caching-specific settings in cassandra.yaml :
key_cache_size_in_mb : By default, it is set to 100 MB or five percent of
the heap size. To disable it globally, set it to zero.
key_cache_save_period : This is the time after which the cache is saved to
the disk to avoid a cold start. A cold start is when a node starts afresh and gets
marred by lots of requests; with no caching at the time of start, it will take some
time to get cache loaded with the most requested keys. During this time, the re-
sponses may be sluggish.
The caches are saved under the directory that is described by the
saved_caches_directory setting in the .yaml file. We configured it during the
cluster deployment in Chapter 4 , Deploying a Cluster . The default value for this setting is
14,400 seconds.
key_cache_keys_to_save : This is the number of keys to save. It is com-
mented to store all the keys. In general, it is okay to let it be commented.
row_cache_size_in_mb : Row caching is disabled by default, by setting this
attribute to zero. Set it to an appropriate positive integer. It may be worth taking a
look at nodetool -h <hostname> cfstats and taking the row mean
size and the number of keys into account.
Search WWH ::




Custom Search