elasticsearch
resource_error
ai_generated
partial
内存溢出:Java堆空间(字段缓存逐出)
OutOfMemoryError: Java heap space (field cache eviction)
ID: elasticsearch/field-cache-eviction-out-of-memory
78%修复率
82%置信度
1证据数
2023-11-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.10.2 | active | — | — | — |
| 8.0.0 | active | — | — | — |
| 8.12.1 | active | — | — | — |
根因分析
字段数据缓存或过滤器缓存消耗过多堆内存,逐出操作导致 JVM 无法释放足够空间而触发内存溢出。
English
The field data cache or filter cache consumes too much heap memory, and eviction triggers an OOM because the JVM cannot free enough space.
官方文档
https://www.elastic.co/guide/en/elasticsearch/reference/current/circuit-breaker.html解决方案
-
在 elasticsearch.yml 中减少字段数据缓存大小:indices.fielddata.cache.size: 20% of heap。重启节点使更改生效。
-
启用字段数据断路器并设置较低限制:PUT /_cluster/settings { "persistent": { "indices.breaker.fielddata.limit": "30%" } }
无效尝试
常见但无效的做法:
-
80% 失败
Larger heap only delays the OOM; the field cache can still grow unbounded and eventually exhaust memory.
-
90% 失败
Disabling the cache causes severe performance degradation for aggregations and sorting on text fields, leading to query failures.