How do I get the cache hit rate in Couchbase?

Is there anyway to monitor the cache hit rate (# of requests that it finds a document / total # requests) in Couchbase. I didn’t see it in the web console and couldn’t find any mention of it in the documentation.

Surely just take the inverse of that figure? So if you have a 30% cache miss rate then 70% of the time you are hitting the cache.

Hi diffbot,

In the web console you can see the ‘cache miss ratio’ so you can just work out the cache hit ratio from that, also useful is the ‘active docs resident’.

If the active docs resident is 100% then your full data set is held in ram and you won’t see any cache misses.

Sorry, I didn’t ask the question well. I did see the ‘cache miss ratio’ graph right in the right in the first row on the web console.

I am asking for stats about (# of requests that it finds a document / total # requests). In other words, what percentage of get requests to a bucket return a value. I looked at all of the graphs in the bucket analytics page and none of them show this.

The graph labeled ‘cache miss ratio’ is the “Percentage of reads per second to this bucket from disk as opposed to RAM (measured from ep_bg_fetches / gets * 100)”

What I’d like to know has nothing to do with whether entries are in RAM or disk. I’m asking about the number of requests found (whether they are in RAM or disk) / the total number of requests. It’s not a ‘hit’ in the sense of it’s in RAM but that it is in Couchbase server. Hope that makes sense.

I’m confused here, you are asking how many requests are found in either ram or disk? Surely it should be 100%? Otherwise you are passing keys to couchbase that you have never set.

Otherwise you are passing keys to couchbase that you have never set.
Yes, precisely. I am using couchbase as a cache before fetching webpages. I’d like to know what percentage of my get requests to a bucket return non-null. (or the complement, what percentage of my get requests to a bucket return null).

Ok I understand now, early in the morning :slight_smile:

I guess this isn’t possible from the couchbase console but you could manage it at your application level, have an atomic counter that you increment if a get request returns null. You could have a counter per day so you can graph it over time.