0

I checked my key cache hit rate via nodetool and opscenter, the first shows a hit rate of 0.907 percent.

Key Cache : entries 1152104, size 96.73 MB, capacity 100 MB, 52543777 hits, 57954469 requests, 0.907 recent hit rate, 14400 save period in seconds

but in opscenter the graph shows 100%. enter image description here

any one understands why the difference?

bhomass
  • 3,414
  • 8
  • 45
  • 75

1 Answers1

3

Cassandra has a perhaps bug (or at least typo) here, it lists it as recent hit cache but its of all time:

https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/tools/nodetool/Info.java#L95

Its grabbing the value of the "total" hitrate:

https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/metrics/CacheMetrics.java#L66

So although you may be getting 100% hit rate for the last 19 minutes according to opscenter it wasn't always 100%. The total number of hits / total number of requests of all time is ~90%.

This is shown from:

52543777 hits, 57954469 requests

52543777 / 57954469 = 0.907
Chris Lohfink
  • 16,150
  • 1
  • 29
  • 38
  • Just wanted to note that the `HitRate` reported in Codahale metrics is still lifetime. So people may want to use `OneMinuteHitRate` (or friends) instead. [Here's the code](https://github.com/apache/cassandra/blob/50027f52322b7c0006c0b3c51cc6517c252e7e59/src/java/org/apache/cassandra/metrics/CacheMetrics.java#L75-L86). – Brian Reischl Mar 06 '19 at 22:17