【发布时间】:2017-01-29 21:54:22
【问题描述】:
我想在 Cassandra 中使用行缓存,但我不明白它是如何工作的。 我在 cassandra.yaml 中启用了行缓存(2GB 分配)并更改了架构:
ALTER TABLE d
with caching = {
'keys' : 'ALL',
'rows_per_partition' : '36000'
};
键缓存工作正常,我的命中率为 90%,而对于行缓存,我从 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
如您所见,缓存仅包含 2 个条目,而我对该表上的所有条目执行了 4M+ 查询。
有什么想法吗?我应该调查什么来了解为什么不使用行缓存?
更新 1 感谢 Chris,我已经使用 row_cache_save_period = 14400 重新配置了集群。但我没有看到任何变化。
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
更新 2 这是架构定义:
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;
更新 3
使用 Cassandra 3.0.9
【问题讨论】:
标签: cassandra