In case of Value only ejection method as per CB documentation the metadata will be retained in memory. So I want to understand that, suppose the user requested for doc_id “abc” where document is pushed to disk (due to resident ratios less than 100 percent) but metadata still in RAM. In that case there will be cache hit or cache miss for those kind of records.
From an application perspective, this would be considered a “cache hit” as the data exists in the database. Even if your application is viewing Couchbase as a “cache”, it still has the data you’re requesting so it’s not a “miss” from your applications perspective.
This is a good example of why our integrated caching layer is so useful…and why naming things in Computer Science is so hard!
If Application considers Couchbase as a cache, then yes, I understand that it will be considered as a cache hit, because the doc is returned by Couchbase to the application. But, my question was not that, perhaps I didn’t ask correctly. Let me re-phrase:
I am referring to the cache miss ratio in Couchbase UI. If application requests a doc whose metadata is in memory, but value is ejected to disk, then Couchbase will have to read the doc from disk and return to application. In such a scenario, would Couchbase (and not application) consider it as a cache miss or a cache hit? I understand that it is a get hit, by the way.
below 2 are clear:
(1) if document metadata as well as value is on disk then it will be considered as a “cache miss”.
(2) if document metadata as well as value is in memory then it will be considered as a “cache hit”.
The question here is, if metadata is in memory and value is on disk, then will it be considered as a “cache miss” or a “cache hit”? IMO, it would be considered a “cache miss”, but @perry , would appreciate if you can share your wisdom here. Thanks!
In this case, the Couchbase UI should match how your application is experiencing it. Couchbase will only record a “cache miss” if the data is not available at all.
@pccb - your description of #1 is not correct. Couchbase (and therefore your application) will only consider a cache miss if the data is not available to be returned…and a DOCUMENT_NOT_FOUND message will be returned. Any other situation, regardless of whether the data and/or metadata is in RAM or not, will be considered a “cache hit” because the data can be returned to the application.
@perry , in my understanding what you are describing is a GET MISS/HIT.
GET MISS - doc is not available in the database at all
GET HIT - doc is available in the database either in memory or on disk
CACHE MISS - doc is available in the database and is on disk
CACHE HIT - doc is available in the database and is in memory
Is that not correct?
Also, the entire discussion is about the cache miss/hit as observed in the Couchbase UI.
Thanks, now I do understand and apologies for not separating the two.
You are correct: a get hit/miss is whether or not the data was returned to the application, whereas the ‘cache miss ratio’ is a measure of how many requests need to be fetched from disk vs being served directly from RAM.
And back to @Debasis_Mallick’s original question - any request that is served from disk is considered a ‘cache miss’, regardless of ejection mode and whether or not the metadata is still in RAM. That data will then be kept in RAM for as long as it can be.