ElasticSearch 100%CPU

时间:2017-09-25 13:55:19

标签: elasticsearch windows-server-2016

创建类似的topic以获得更好的问题覆盖率。

将ElasticSearch 5.4.0用作Windows服务。 Windows Server 2016具有16 GB RAM。

通过命令安装:elasticsearch-service.bat manager

Java选项:

-Xms8g
-Xmx8g
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+DisableExplicitGC
-XX:+AlwaysPreTouch
-Xss1m
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djna.nosys=true
-Djdk.io.permissionsUseCanonicalPath=true
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-Dlog4j.skipJansi=true
-Delasticsearch
-Des.path.home=C:\elasticsearch
-Des.default.path.logs=C:\elasticsearch\logs
-Des.default.path.data=C:\elasticsearch\data
-Des.default.path.conf=C:\elasticsearch\config

初始内存池:8192 MB

最大内存池:8192 MB

线程堆栈大小:1024 KB。

使用norconex抓取工具创建索引后填充数据一次。完成工作后,任务管理器中的过程几乎都是100%。它有时降低到0%或25%,但一分钟后恢复到95%。

ElasticSearch.log文件中填充了此类记录:

[2017-09-25T16:23:13,166][INFO ][o.e.m.j.JvmGcMonitorService] [Zugx4zq] [gc][9415] overhead, spent [364ms] collecting in the last [1s]
[2017-09-25T16:23:14,534][INFO ][o.e.m.j.JvmGcMonitorService] [Zugx4zq] [gc][9416] overhead, spent [647ms] collecting in the last [1.3s]
[2017-09-25T16:23:15,550][INFO ][o.e.m.j.JvmGcMonitorService] [Zugx4zq] [gc][9417] overhead, spent [397ms] collecting in the last [1s]
[2017-09-25T16:23:16,708][WARN ][o.e.m.j.JvmGcMonitorService] [Zugx4zq] [gc][9418] overhead, spent [657ms] collecting in the last [1.1s]
[2017-09-25T16:23:17,745][INFO ][o.e.m.j.JvmGcMonitorService] [Zugx4zq] [gc][9419] overhead, spent [494ms] collecting in the last [1s]

请求执行时间太长或因执行错误而失败:

org.elasticsearch.transport.RemoteTransportException: [Zugx4zq][127.0.0.1:9300][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.common.util.concurrent.EsRejectedExecutionException: rejected execution of org.elasticsearch.transport.TransportService$7@25194f on EsThreadPoolExecutor[search, queue capacity = 1000, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@48fa409f[Running, pool size = 7, active threads = 7, queued tasks = 1000, completed tasks = 93134]]

org.elasticsearch.transport.RemoteTransportException: [Zugx4zq][127.0.0.1:9300][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.common.util.concurrent.EsRejectedExecutionException: rejected execution of org.elasticsearch.transport.TransportService$7@34fbd561 on EsThreadPoolExecutor[search, queue capacity = 1000, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@48fa409f[Running, pool size = 7, active threads = 7, queued tasks = 1000, completed tasks = 118501]]

我不明白是谁在这项服务上产生了这种加载。所有这些任务都在哪里(排队任务= 1000)?如何监控服务加载?我错过了什么样的服务微调?我不是DevOps或专业系统管理员,我是.net程序员,所以所有这些java应用程序对我来说都是一块黑暗的木头。

更新

服务器RAM增加到32GB。堆大小更改为24 GB。 CPU利用率降低到最小值。奇怪的是,具有17k文档且大小为1.1 GB的索引的堆大小不是8 GB。

2 个答案:

答案 0 :(得分:0)

你想知道你实际上在哪里花时间。最简单的方法是使用监控插件:您需要Kibana和X-Pack监控插件(免费提供),有关屏幕截图,请参阅https://www.elastic.co/products/x-pack/monitoring

PS:快速浏览一下,您正在使用默认的JVM选项。这通常很好。不要开始疯狂的调整,他们往往会使情况变得更糟。

答案 1 :(得分:0)

相关问题