{
  "id": "elasticsearch/script-cache-eviction-memory-pressure",
  "signature": "ElasticsearchException: [script_cache] eviction triggered, current heap usage [92%], max cache size [10000]",
  "signature_zh": "Elasticsearch异常：[脚本缓存] 驱逐触发，当前堆使用率[92%]，最大缓存大小[10000]",
  "regex": "ElasticsearchException: \\[script_cache\\] eviction triggered, current heap usage \\[\\d+%\\], max cache size \\[\\d+\\]",
  "domain": "elasticsearch",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The script cache is full and heap memory usage is high, causing Elasticsearch to evict compiled scripts to free memory, which degrades performance.",
  "root_cause_type": "generic",
  "root_cause_zh": "脚本缓存已满且堆内存使用率很高，导致Elasticsearch驱逐已编译的脚本以释放内存，从而降低性能。",
  "versions": [
    {
      "version": "7.17.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Larger heap may delay eviction but does not fix the root cause of too many unique scripts being compiled; cache still fills up",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling the cache forces recompilation on every script execution, causing severe performance degradation and potential OOM",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the script cache size in elasticsearch.yml: script.cache.max_size: 20000 and restart nodes, or use dynamic setting: PUT _cluster/settings { \"transient\": { \"script.cache.max_size\": \"20000\" } }",
      "success_rate": 0.8,
      "how": "Increase the script cache size in elasticsearch.yml: script.cache.max_size: 20000 and restart nodes, or use dynamic setting: PUT _cluster/settings { \"transient\": { \"script.cache.max_size\": \"20000\" } }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce script variety by parameterizing inline scripts: use stored scripts or parameters instead of generating unique script sources per query, e.g., { \"script\": { \"id\": \"my_script\", \"params\": { \"factor\": 2 } } }",
      "success_rate": 0.9,
      "how": "Reduce script variety by parameterizing inline scripts: use stored scripts or parameters instead of generating unique script sources per query, e.g., { \"script\": { \"id\": \"my_script\", \"params\": { \"factor\": 2 } } }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在elasticsearch.yml中增加脚本缓存大小：script.cache.max_size: 20000并重启节点，或使用动态设置：PUT _cluster/settings { \"transient\": { \"script.cache.max_size\": \"20000\" } }",
    "通过参数化内联脚本减少脚本种类：使用存储脚本或参数代替每次查询生成唯一脚本源，例如 { \"script\": { \"id\": \"my_script\", \"params\": { \"factor\": 2 } } }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/circuit-breaker.html#script-compilation-circuit-breaker",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2024-06-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}