At the Peer metrics callback, I get :ObjectCache
metrics like {:lo 0, :hi 1, :sum 3996966, :count 4007439}
. According to the documentation, I assume that I can calculate the hit ratio with (/ (double sum) count)
. My problem is that the hit ratio is always very near to one even if I have considerable :StorageGetBytes
. Do I have a false understanding of the :ObjectCache
peer metric? I use Datomic Pro v0.9.5966.
You are correct in your calculation of the hit rate.
If your ratio is near to one, that indicates that you are almost always reading data from the local Object Cache.
The StorageGetBytes metric represents reads from storage. If your system has good data locality and you have a large object cache, I would expect this kind of behavior. The occasional object cache miss will retrieve segment(s) from storage, which will be reported in the StorageGetBytes, and potentially subsequent queries will use those segments from the local Object Cache.
Thanks for your reply. I tried to get the cache hit ratio down by scaling the cache size down. That didn’t work. But perhaps I have to try again.