Reputation: 479
I'd like to use row cache in Cassandra but I do not understand how it works. I've enabled row cache in cassandra.yaml (2GB allocation) and changed the schema:
ALTER TABLE d
with caching = {
'keys' : 'ALL',
'rows_per_partition' : '36000'
};
The key cache is working properly and I have an hit rate of 90%, while for row cache I see these numbers from nodetool info
:
Row Cache : entries 2, size 2 bytes, capacity 1.95 GB, 1620 hits, 39699640 requests, 0.000 recent hit rate, 0 save period in seconds
As you can see, cache contains only 2 entries, while I've performed 4M+ queries on all the entries on that table.
Any idea? What should I investigate to understand why the row cache is not used?
UPDATE 1 Thanks to Chris, I've reconfigured cluster with row_cache_save_period = 14400. But I see no changes.
Row Cache : entries 0, size 0 bytes, capacity 1.95 GB, 0 hits, 85098 requests, 0.000 recent hit rate, 14400 save period in seconds
UPDATE 2 Here is schema definition:
CREATE TABLE d_t (
id bigint,
xid bigint,
ts timestamp,
avg double,
ce double,
cg double,
p double,
w double,
c double,
sum double,
last double,
max double,
min double,
p75 double,
p90 double,
p95 double,
squad double,
sumq double,
wavg double,
weight double,
PRIMARY KEY ((id), xid, ts)
) WITH CLUSTERING ORDER BY (xid DESC, ts DESC)
and compaction = {'class': 'SizeTieredCompactionStrategy'}
and gc_grace_seconds=86400
and caching = { 'keys' : 'ALL', 'rows_per_partition':'36000' }
and min_index_interval = 2
and max_index_interval = 20;
UPDATE 3
Using Cassandra 3.0.9
Upvotes: 2
Views: 4268
Reputation: 479
I got the point. Sharing for other users. There was some bugs in 3.0.x row cache implementation and most problematic point is 'clustering order by' clause. After removing order by, row cache started working. I've tested this on 3.9. BUT, row cache is used iif the where condition ONLY contains partition keys. In case a filter on clustering columns is specified, cache is not evaluated. This is really strange, but that's it. Here are more detail: https://issues.apache.org/jira/browse/CASSANDRA-8646
Upvotes: 2
Reputation: 16400
You set the row_cache_size_in_mb
option. You also need to set row_cache_save_period
, which you have as 0
(default). That disables it. This is shown in the 0 save period in seconds
part of message.
Upvotes: 4