Elasticsearch 7.x 断路器 - 数据太大 - 故障排除
Elasticsearch 7.x circuit breaker - data too large - troubleshoot
问题:
自从从 ES-5.4 升级到 ES-7.2 后,当我尝试从我的多线程 Java 应用程序(使用elasticsearch-rest-high-level-client-7.2.0.jar
java 客户端)到 2-4 个节点的 ES 集群。
我的ES配置:
Elasticsearch version: 7.2
custom configuration in elasticsearch.yml:
thread_pool.search.queue_size = 20000
thread_pool.write.queue_size = 500
I use only the default 7.x circuit-breaker values, such as:
indices.breaker.total.limit = 95%
indices.breaker.total.use_real_memory = true
network.breaker.inflight_requests.limit = 100%
network.breaker.inflight_requests.overhead = 2
来自elasticsearch.log的错误:
{
"error": {
"root_cause": [
{
"type": "circuit_breaking_exception",
"reason": "[parent] Data too large, data for [<http_request>] would be [3144831050/2.9gb], which is larger than the limit of [3060164198/2.8gb], real usage: [3144829848/2.9gb], new bytes reserved: [1202/1.1kb]",
"bytes_wanted": 3144831050,
"bytes_limit": 3060164198,
"durability": "PERMANENT"
}
],
"type": "circuit_breaking_exception",
"reason": "[parent] Data too large, data for [<http_request>] would be [3144831050/2.9gb], which is larger than the limit of [3060164198/2.8gb], real usage: [3144829848/2.9gb], new bytes reserved: [1202/1.1kb]",
"bytes_wanted": 3144831050,
"bytes_limit": 3060164198,
"durability": "PERMANENT"
},
"status": 429
}
想法:
我很难确定问题的根源。
当使用 <=8gb 堆大小的 ES 集群节点(在 <=16gb 虚拟机上)时,问题变得非常明显,因此,一个明显的解决方案是增加节点的内存。
但是我觉得增加内存只会隐藏问题。
问题:
我想了解哪些情况可能导致此错误?
我可以采取什么措施来妥善处理?
(更改断路器值,更改 es.yml 配置,change/limit 我的 ES 请求)
原因是节点的堆非常满,被断路器捕获是很好的,因为它可以防止节点 运行 进入 OOM,变得陈旧和崩溃...
弹性搜索 6.2.0 introduced the circuit breaker and improved it in 7.0.0。随着版本从 ES-5.4 升级到 ES-7.2,您 运行 直接进入了这一改进。
到目前为止我看到了 3 个解决方案:
- 如果可能,增加堆大小
- 如果可行,减少批量请求的大小
- 扩展你的集群,因为分片消耗了大量的堆,没有留下任何东西来处理大请求。更多节点将帮助集群在更多节点之间分配分片和请求,从而导致所有节点上的 AVG 堆使用率更低。
作为一种丑陋的解决方法(不解决问题),可以增加限制 after reading and understanding the implications:
所以我花了一些时间研究 ES 究竟是如何实现新的断路器机制的,并试图理解为什么我们会突然出现这些错误?
- 断路器机制从第一个版本开始就存在。
- 我们在从版本 5.4 迁移到 7.2 时开始遇到问题
- 在 7.2 ES 版本中引入了一种计算熔断的新方法:基于实际内存使用的熔断(为什么以及如何:https://www.elastic.co/blog/improving-node-resiliency-with-the-real-memory-circuit-breaker, code: https://github.com/elastic/elasticsearch/pull/31767)
- 在我们将 ES 内部升级到 7.2 版本时,我们将 jdk 从 8 更改为 11。
- 作为我们内部升级的一部分,我们还更改了 jvm.options 默认配置,将官方推荐的 CMS GC 切换为 G1GC GC,后者得到了 elasticsearch 的全新支持。
- 考虑到以上所有,我发现了这个在 7.4 版本中修复的关于断路器与 G1GC GC 一起使用的错误:https://github.com/elastic/elasticsearch/pull/46169
如何修复:
- 将配置更改回 CMS GC。
- 或者,进行修复。该错误的修复只是一个配置更改,可以在您的部署中轻松更改和测试。
问题:
自从从 ES-5.4 升级到 ES-7.2 后,当我尝试从我的多线程 Java 应用程序(使用elasticsearch-rest-high-level-client-7.2.0.jar
java 客户端)到 2-4 个节点的 ES 集群。
我的ES配置:
Elasticsearch version: 7.2
custom configuration in elasticsearch.yml:
thread_pool.search.queue_size = 20000
thread_pool.write.queue_size = 500
I use only the default 7.x circuit-breaker values, such as:
indices.breaker.total.limit = 95%
indices.breaker.total.use_real_memory = true
network.breaker.inflight_requests.limit = 100%
network.breaker.inflight_requests.overhead = 2
来自elasticsearch.log的错误:
{
"error": {
"root_cause": [
{
"type": "circuit_breaking_exception",
"reason": "[parent] Data too large, data for [<http_request>] would be [3144831050/2.9gb], which is larger than the limit of [3060164198/2.8gb], real usage: [3144829848/2.9gb], new bytes reserved: [1202/1.1kb]",
"bytes_wanted": 3144831050,
"bytes_limit": 3060164198,
"durability": "PERMANENT"
}
],
"type": "circuit_breaking_exception",
"reason": "[parent] Data too large, data for [<http_request>] would be [3144831050/2.9gb], which is larger than the limit of [3060164198/2.8gb], real usage: [3144829848/2.9gb], new bytes reserved: [1202/1.1kb]",
"bytes_wanted": 3144831050,
"bytes_limit": 3060164198,
"durability": "PERMANENT"
},
"status": 429
}
想法:
我很难确定问题的根源。
当使用 <=8gb 堆大小的 ES 集群节点(在 <=16gb 虚拟机上)时,问题变得非常明显,因此,一个明显的解决方案是增加节点的内存。
但是我觉得增加内存只会隐藏问题。
问题:
我想了解哪些情况可能导致此错误?
我可以采取什么措施来妥善处理?
(更改断路器值,更改 es.yml 配置,change/limit 我的 ES 请求)
原因是节点的堆非常满,被断路器捕获是很好的,因为它可以防止节点 运行 进入 OOM,变得陈旧和崩溃...
弹性搜索 6.2.0 introduced the circuit breaker and improved it in 7.0.0。随着版本从 ES-5.4 升级到 ES-7.2,您 运行 直接进入了这一改进。
到目前为止我看到了 3 个解决方案:
- 如果可能,增加堆大小
- 如果可行,减少批量请求的大小
- 扩展你的集群,因为分片消耗了大量的堆,没有留下任何东西来处理大请求。更多节点将帮助集群在更多节点之间分配分片和请求,从而导致所有节点上的 AVG 堆使用率更低。
作为一种丑陋的解决方法(不解决问题),可以增加限制 after reading and understanding the implications:
所以我花了一些时间研究 ES 究竟是如何实现新的断路器机制的,并试图理解为什么我们会突然出现这些错误?
- 断路器机制从第一个版本开始就存在。
- 我们在从版本 5.4 迁移到 7.2 时开始遇到问题
- 在 7.2 ES 版本中引入了一种计算熔断的新方法:基于实际内存使用的熔断(为什么以及如何:https://www.elastic.co/blog/improving-node-resiliency-with-the-real-memory-circuit-breaker, code: https://github.com/elastic/elasticsearch/pull/31767)
- 在我们将 ES 内部升级到 7.2 版本时,我们将 jdk 从 8 更改为 11。
- 作为我们内部升级的一部分,我们还更改了 jvm.options 默认配置,将官方推荐的 CMS GC 切换为 G1GC GC,后者得到了 elasticsearch 的全新支持。
- 考虑到以上所有,我发现了这个在 7.4 版本中修复的关于断路器与 G1GC GC 一起使用的错误:https://github.com/elastic/elasticsearch/pull/46169
如何修复:
- 将配置更改回 CMS GC。
- 或者,进行修复。该错误的修复只是一个配置更改,可以在您的部署中轻松更改和测试。