SOLR documentCache JMX 指标说明

SOLR documentCache JMX metrics clarification

我正在尝试了解 SOLR 中缓存的 JMX 数据 -

根据我的理解,'size' 属性指示缓存的大小(以 KB 为单位)[引用此文档 - https://lucene.apache.org/solr/guide/7_0/performance-statistics-reference.html#statistics-for-caches]。

{
  "CACHE.searcher.documentCache":{
    "lookups":0,
    "hits":0,
    "cumulative_evictions":0,
    "size":30,
    "hitratio":0.0,
    "evictions":0,
    "cumulative_lookups":370080,
    "cumulative_hitratio":0.09,
    "warmupTime":0,
    "inserts":30,
    "cumulative_inserts":337571,
    "cumulative_hits":32509}}

并且在配置中,size 参数是可以缓存的最大文档数[引用这个 - https://lucene.apache.org/solr/guide/7_0/query-settings-in-solrconfig.html#documentcache]。

<documentCache class="solr.LRUCache"
               size="15000"
               initialSize="512"
               autowarmCount="100"/>  

这两个假设都是真的吗?

另外,为什么我当前的搜索器 documentCache 大小这么小?我可以看到有很多插页,但大小只有 30 个。为什么?

当打开新的搜索器时,缓存的内容会被删除 - 通常是在发生提交或优化时(基础索引已更改并且您希望这些更改可见)。

针对此特定搜索者跟踪 inserthits 等中的值。在您的示例中,大小当前为 30 - 并且已经插入了 30 个 - 因此没有任何内容因溢出而从缓存中删除。配置中给出的大小是缓存将容纳的最大项目数,而 JMX 统计中的数字是缓存的 实际 大小。由于您在 hits 字段等中有 0,因此此缓存从未有过任何体面的使用,因为到目前为止每个请求都导致插入而不是从缓存返回查找。

cumulative_are tracked since the node was started - 不仅针对当前索引搜索器。

您的命中率相当低,可能是因为搜索器关闭和重新打开的频率太高,以至于缓存无法发挥任何实际作用。