The “Positive entries” and “Negative entries” stats are in the nscd -g command under “hosts cache” section. From the nscd.conf manual, I see that “positive entries are successful queries in the specified cache” and “negative entries (unsuccessful queries) in the specified cache”. But, how can a unsuccessful query(negative entry) in cache have hits(cache hits on negative entries), when the query itself means it can’t find the value in cache… Can’t understand the difference between those two.. Can some please explain them in simple terms?
{code}
"hosts cache: yes cache is enabled yes cache is persistent yes cache is shared 211 suggested size 216064 total data pool size 12880 used data pool size 3600 seconds time to live for positive entries 20 seconds time to live for negative entries 102658 cache hits on positive entries 221 cache hits on negative entries 129187 cache misses on positive entries 10926 cache misses on negative entries 42% cache hit rate 74 current number of cached values 167 maximum number of cached values 8 maximum chain length searched 0 number of delays on rdlock 0 number of delays on wrlock 0 memory allocations failed yes check /etc/hosts for changes"
{code}
Advertisement
Answer
nscd has nothing to do with FreeIPA.
Positive cache entries are the ones that were found to exist and can be cached for longer time as it is assumed that they would not change so often.
Negative cache entries are the ones that were found to not exist at the source for some reason and this fact is cached for shorter time. The reason for negative caching is to avoid excessive load on the source as that might be more time and effort consuming than for positively cached entries. For example, one might get a negative cache entry due to an operation timeout. Repeating the same request in short amount of time would cause each of these operations to time out. Negative cache allows to answer these requests from cache over the cache TTL (the result would be ‘entry does not exist’) but then retry again to retrieve the data from the original source once TTL is expired for a negative cache entry.