Database Reference
In-Depth Information
Name
Description
row_cache_save_period
By default row cache is disabled, enabling it would im-
prove on cold start and cache can be expensive and
memory intensive.
row_cache_keys_to_save
By default disable. Number of keys of row cache to be
saved.
Row cache comes in very handy and reduces disk read significantly for frequently
accessed rows. But it consumes a lot of space as well. It is recommended to enable row
cache if the application's requirement is to fetch a complete row instead of select
columns very often.
To enable a cache for a specific column family, we can enable it while creating a
column family as follows:
create table user(user_id text primary key,fname text)
with caching='keys_only';
create table tweets(tweet_id text primary key,body text)
with caching='rows_only';
In the preceding script for a column family, user caching has been enabled for keys
but for the tweets table it is enabled for rows. It is recommended to enable row cache
where the application would require reading entire rows rather than selected columns.
Obviously with the selected column approach, having row cache enabled would have
an adverse impact and be a waste of in-memory space by keeping rows within memory
for no purpose.
The following code snippet shows how to configure these cache parameters in the
Cassandra.yaml file:
# 50 MB keys to be saved in cache.
key_cache_size_in_mb: 50
# 5 minutes or 3600 seconds to keep keys cached in cache
key_cache_save_period: 3600
# 100 keys to save in key cache
key_cache_keys_to_save: 100
#keep 100 mb of rows in cache
row_cache_size_in_mb: 100
# 5 minute or 3600 seconds, duration to keep rows in
cache.
Search WWH ::




Custom Search