监控和调整缓存
通过小的增量调整来更改缓存选项,然后使用nodetool监控每个更改的效果。nodetool info命令的输出 显示以下行缓存和密钥缓存设置值,这些值在cassandra.yaml文件中配置:
Cache size in bytes(高速缓存的大小)
Capacity in bytes(容量以字节为单位)
Number of hits(点击次数)
Number of requests(请求数)
Recent hit rate(近期命中率)
Duration in seconds after which Cassandra saves the key cache(以秒为单位的持续时间,之后Cassandra将保存密钥缓存)
例如,在启动时,来自nodetool info的信息可能如下所示:
ID : 387d15ba-7103-491b-9327-1a691dbb504a
Gossip active : true
Thrift active : true
Native Transport active: true
Load : 65.87 KB
Generation No : 1400189757
Uptime (seconds) : 148760
Heap Memory (MB) : 392.82 / 1996.81
datacenter : datacenter1
Rack : rack1
Exceptions : 0
Key Cache : entries 10, size 728 (bytes), capacity 103809024 (bytes), 93 hits, 102 requests, 0.912 recent hit rate, 14400 save period in seconds
Row Cache : entries 0, size 0 (bytes), capacity 0 (bytes), 0 hits, 0 requests, NaN recent hit rate, 0 save period in seconds
Counter Cache : entries 0, size 0 (bytes), capacity 51380224 (bytes), 0 hits, 0 requests, NaN recent hit rate, 7200 save period in seconds
Token : -9223372036854775808
注意:在高内存消耗的情况下,考虑调整数据缓存。