"正条目"和"负条目"统计信息位于"主机缓存"部分下的nscd -g命令中。从 nscd.conf 手册中,我看到"正条目是指定缓存中的成功查询"和"指定缓存中的负条目(不成功的查询)"。但是,当查询本身意味着它无法在缓存中找到值时,缓存中不成功的查询(负条目)怎么会有命中(缓存命中负条目)......无法理解这两者之间的区别..有些人能用简单的术语解释一下吗?
{代码}
"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"
{代码}
nscd 与 FreeIPA 无关。
正缓存条目是发现存在的条目,并且可以缓存更长的时间,因为假设它们不会经常更改。
负缓存条目是由于某种原因发现源中不存在的条目,并且这一事实缓存的时间较短。负缓存的原因是为了避免源上的负载过多,因为与正缓存条目相比,这可能花费更多的时间和精力。例如,由于操作超时,可能会获得负缓存条目。在短时间内重复相同的请求将导致其中每个操作超时。负缓存允许通过缓存 TTL 从缓存中应答这些请求(结果将是"条目不存在"),但在负缓存条目的 TTL 过期后再次重试以从原始源检索数据。