Jeremy
Jeremy

Reputation: 3548

SOLR documentCache JMX metrics clarification

I'm trying to understand the JMX data for the caches in SOLR -

From my understanding, the 'size' attribute indicates the size of the cache in KB [referencing this document - 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}}

And in the configuration, the size parameter is the maximum number of documents that can be cached [ referencing this - https://lucene.apache.org/solr/guide/7_0/query-settings-in-solrconfig.html#documentcache ].

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

Are both those assumptions true?

Also, why is my current searcher documentCache size so small? I can see there have been lots of inserts, but the size is only 30. Why?

Upvotes: 0

Views: 179

Answers (1)

MatsLindh
MatsLindh

Reputation: 52802

The contents of the cache is expunged when a new searcher is opened - usually when a commit or an optimize happens (where the underlying index has changed and you want those changes to be visible).

The values in insert, hits, etc. are tracked for this specific searcher. In your example the size is currently 30 - and there has been 30 inserts - so nothing has been expunged from the cache because of overflow. The size given in the configuration is the maximum number of items the cache will hold, while the number in your JMX stat is the actual size of the cache. Since you have 0 in hits fields, etc., this cache has never had any decent use, since each request so far has lead to an insert instead of returning a lookup from the cache.

The cumulative_ values are tracked since the node was started - and not only for the current index searcher.

You have a rather small hit ratio, possibly because of the searcher being closed and reopened too often for the cache to have any real effect.

Upvotes: 1

Related Questions