Elasticsearch Java使用非常高的CPU和MEMORY

时间:2016-03-01 10:50:15

标签: java linux node.js amazon-web-services elasticsearch

由于CPU使用率很高,Elasticsearch突然停止工作,现在当我重新启动它时,它继续使用大约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} {本地主机/ 127.0.0.1:9300}     热门话题:2016-03-01T10:24:09.884Z,interval = 500ms,busiestThreads = 3,ignoreIdleThreads = true:          93.7%(500ms中的468.4ms)线程' elasticsearch [elasticnode] [clusterService#updateTask] [T#1]'            10/10快照共享29个元素              sun.nio.fs.UnixNativeDispatcher.readdir(Native方法)              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%(500毫秒中的263.4微米)线程' elasticsearch [elasticnode] [transport_clie
]的cpu使用率   nt_timer] [T#1] {哈希轮计时器#1}'        10/10快照共享以下5个元素          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);
}

知道这是关于什么的吗?我可以根据需要提供任何其他信息。

1 个答案:

答案 0 :(得分:1)

基于评论。您有cronjob每10分钟运行 node.js JavaScript中运行文件。根据您的问题,您可以在同一服务器上ping JS文件PHP文件。在同一台服务器上,您有一个运行Java内容的posix内核。

CPU过载问题的答案是:

选择一个系统。您有三个环境在同一个实例上运行。 Java和PHP在ApacheNGINX上的Node.JS上运行。而你甚至不应该跨越Java和PHP。这就是问题所在。它就像是同时运行AutoCad,Final Cut Pro和Unreal Game Engine ......并不像那样工作。

将系统简化为您选择的一种语言,当然由AWS SDK's支持。