Skip to content

Grow queryResultCache (size=512, 56% hit rate, 317K evictions) #266

@gaurav

Description

@gaurav

Summary

Production /status?full=true shows the Solr queryResultCache is undersized for the workload. filterCache is sized correctly (99.8 % hit ratio, no evictions), so the same workload is mostly variation in the q clause that queryResultCache is supposed to absorb.

Evidence

Cache Hit ratio Size Lookups Hits Evictions
filterCache 0.998 74 43,030 42,956 0
queryResultCache 0.565 512 749,258 423,353 317,758

A 56 % hit rate on a cache that has evicted 317 K entries strongly suggests the working set is much larger than the configured 512 slots.

Suggested action

In solrconfig.xml (managed in the Helm chart, not this repo), bump queryResultCache to:

<queryResultCache class="solr.search.CaffeineCache"
                  size="4096"
                  initialSize="2048"
                  maxRamMB="512"
                  autowarmCount="0"/>

Using maxRamMB rather than (or in addition to) size bounds the cache by memory rather than entry count and is generally more robust.

How to verify after deploy

Hit /status?full=true after the change and a soak period:

  • solr.cache.queryResultCache.size reflects the new ceiling
  • solr.cache.queryResultCache.hitratio rises (target: > 0.85)
  • solr.cache.queryResultCache.evictions rate per hour drops sharply

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions