ES_SHARD_CACHE_EVICTION_MEM elasticsearch resource_error ai_generated true

ElasticsearchException: shard request cache eviction triggered memory pressure, current heap usage [85%]

ID: elasticsearch/shard-request-cache-eviction-memory-pressure

Also available as: JSON · Markdown · 中文
83%Fix Rate
88%Confidence
1Evidence
2024-09-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.17.0 active
8.11.0 active
8.12.0 active

Root Cause

The shard request cache grows too large under high query load, causing frequent evictions that increase heap pressure and degrade performance.

generic

中文

在高查询负载下,分片请求缓存增长过大,导致频繁逐出,增加堆压力并降低性能。

Official Documentation

https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html

Workarounds

  1. 80% success Reduce cache size by setting `indices.requests.cache.size: 1%` in `elasticsearch.yml` to limit heap usage.
    Reduce cache size by setting `indices.requests.cache.size: 1%` in `elasticsearch.yml` to limit heap usage.
  2. 85% success Use explicit query caching with `?request_cache=true` only for queries that benefit from it, and set `index.requests.cache.enable: false` on indices with high write volume.
    Use explicit query caching with `?request_cache=true` only for queries that benefit from it, and set `index.requests.cache.enable: false` on indices with high write volume.
  3. 90% success Monitor cache eviction rates via `GET _nodes/stats/indices/request_cache` and optimize queries to reduce cache churn.
    Monitor cache eviction rates via `GET _nodes/stats/indices/request_cache` and optimize queries to reduce cache churn.

中文步骤

  1. Reduce cache size by setting `indices.requests.cache.size: 1%` in `elasticsearch.yml` to limit heap usage.
  2. Use explicit query caching with `?request_cache=true` only for queries that benefit from it, and set `index.requests.cache.enable: false` on indices with high write volume.
  3. Monitor cache eviction rates via `GET _nodes/stats/indices/request_cache` and optimize queries to reduce cache churn.

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Larger heap delays evictions but doesn't solve the root cause of excessive caching; cache can grow unbounded and cause GC issues.

  2. 65% fail

    Disabling cache increases query latency for repeated queries, especially in dashboards or reporting scenarios.