Elasticsearch 由于 CPU 使用率过高突然停止工作,现在当我重新启动它时,它一直在使用大约 100% 的 CPU 和 58% 的内存,它并没有下降。大约有 1.300.000 条数据链接到 Elasticsearch。使用 Linux 服务器 Ubuntu 15.04
默认/ Elasticsearch
ES_HEAP_SIZE=2g (half of my memeory)
MAX_OPEN_FILES=65535
MAX_LOCKED_MEMORY=unlimited
limits.conf
elasticsearch - nofile 65535
elasticsearch - memlock unlimited
elasticsearch.yml
bootstrap.mlockall: true
curl http://localhost:9200/_nodes/hot_threads?pretty=true
::: {elasticnode}{wrdxzFcXT0aTXnp4R5KFbA}{127.0.0.1}{localhost/127.0.0.1:9300} Hot threads at 2016-03-01T10:24:09.884Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true: 93.7% (468.4ms out of 500ms) cpu usage by thread 'elasticsearch[elasticnode][clusterService#updateTask][T#1]' 10/10 snapshots sharing following 29 elements sun.nio.fs.UnixNativeDispatcher.readdir(Native Method) sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterator.readNextEntry(UnixDirectoryStream.java :168) sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterator.hasNext(UnixDirectoryStream.java:201) org.elasticsearch.index.translog.Translog$OnCloseRunnable.handle(Translog.java:726) org.elasticsearch.index.translog.Translog$OnCloseRunnable.handle(Translog.java:713) org.elasticsearch.index.translog.ChannelReference.closeInternal(ChannelReference.java:67) org.elasticsearch.common.util.concurrent.AbstractRefCounted.decRef(AbstractRefCounted.java: 64) org.elasticsearch.index.translog.TranslogReader.close(TranslogReader.java:143) org.apache.lucene.util.IOUtils.close(IOUtils.java:97) org.elasticsearch.index.translog.Translog.close(Translog.java:425) org.apache.lucene.util.IOUtils.close(IOUtils.java:97) org.apache.lucene.util.IOUtils.close(IOUtils.java:84) org.elasticsearch.index.engine.InternalEngine.closeNoLock(InternalEngine.java:990) org.elasticsearch.index.engine.Engine.close(Engine.java:1147) org.apache.lucene.util.IOUtils.close(IOUtils.java:97) org.apache.lucene.util.IOUtils.close(IOUtils.java:84) org.elasticsearch.index.shard.IndexShard.close(IndexShard.java:837) org.elasticsearch.index.IndexService.closeShardInjector(IndexService.java:443) org.elasticsearch.index.IndexService.removeShard(IndexService.java:416) org.elasticsearch.indices.cluster.IndicesClusterStateService.failAndRemoveShard(IndicesClus terStateService.java:743) org.elasticsearch.indices.cluster.IndicesClusterStateService.applyMappings(IndicesClusterSt ateService.java:364) org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterS tateService.java:164) org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalCluste rService.java:600) org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterServ ice.java:762) org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPriorit izedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231) org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPriorit izedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)
0.1% (263.4micros out of 500ms) cpu usage by thread 'elasticsearch[elasticnode][transport_clie
nt_timer][T#1]{Hashed wheel timer #1}' 10/10 snapshots sharing following 5 elements java.lang.Thread.sleep(Native Method)org.jboss.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:445) org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:364) org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) java.lang.Thread.run(Thread.java:745)
查询示例。这是 elasticsearch.php
中的代码:
public function advancedquery($type, $query) {
return $this->call($type . '/_search', 'POST', $query);
}
知道这是关于什么的吗?我可以根据需要提供任何其他信息。
最佳答案
基于评论。您有一个每 10 分钟运行一次的 cronjob
,它让 node.js 在 JavaScript
中运行一个文件。根据您的问题,您有 JS
文件在同一台服务器上 ping PHP
文件。在同一台服务器上,您有一个运行 posix
内容的 Java
核心。
您的 CPU 过载问题的答案是:
选择一个系统。您在同一个实例上运行了三个环境。 Java 和 PHP 在 Apache 上运行, Node.JS NGINX .而且您甚至不应该交叉使用 Java 和 PHP。那就是问题所在。这就像同时运行 AutoCad、Final Cut Pro 和 Unreal Game Engine 一样……不是那样工作的。
将您的系统压缩成您选择的一种语言,由 AWS SDK's 支持当然。
关于java - 使用非常高的 CPU 和内存的 Elasticsearch Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35720928/