Hi pals,
I have installed a single node of the elastic on a server with following configuration:
OS: Windows Server 2016
Processors: 2 processors of the Intel(R) Xeon CPU E5-2699 v4 @ 2.20GHZ
RAM: 32 GB (16 GB dedicated to the JVM)
I get high CPU usages (often over 70%) during the day. When getting the hot
thread, I get the following messages in different time slots:
::: {ELASTIC-SRV1}{Pbra1KbPRzGKWxoIxPg0Lw}{CW6FO8xHTCaPXYUx_zuKQg}{<server address>}{<elastic address>}{ml.machine_memory=34359267328, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
Hot threads at 2019-06-23T07:41:51.708, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
37.5% (187.5ms out of 500ms) cpu usage by thread 'elasticsearch[ELASTIC-SRV1][refresh][T#1]'
4/10 snapshots sharing following 30 elements
org.apache.lucene.index.IndexWriter.createCompoundFile(IndexWriter.java:4997)
org.apache.lucene.index.DocumentsWriterPerThread.sealFlushedSegment(DocumentsWriterPerThread.java:576)
org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:515)
org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:554)
org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:719)
org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:492)
org.apache.lucene.index.StandardDirectoryReader.doOpenFromWriter(StandardDirectoryReader.java:294)
org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:269)
org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:259)
org.apache.lucene.index.FilterDirectoryReader.doOpenIfChanged(FilterDirectoryReader.java:112)
org.apache.lucene.index.DirectoryReader.openIfChanged(DirectoryReader.java:140)
org.apache.lucene.search.SearcherManager.refreshIfNeeded(SearcherManager.java:156)
org.apache.lucene.search.SearcherManager.refreshIfNeeded(SearcherManager.java:58)
org.apache.lucene.search.ReferenceManager.doMaybeRefresh(ReferenceManager.java:176)
org.apache.lucene.search.ReferenceManager.maybeRefreshBlocking(ReferenceManager.java:253)
org.elasticsearch.index.engine.InternalEngine$ExternalSearcherManager.refreshIfNeeded(InternalEngine.java:322)
org.elasticsearch.index.engine.InternalEngine$ExternalSearcherManager.refreshIfNeeded(InternalEngine.java:297)
org.apache.lucene.search.ReferenceManager.doMaybeRefresh(ReferenceManager.java:176)
org.apache.lucene.search.ReferenceManager.maybeRefreshBlocking(ReferenceManager.java:253)
org.elasticsearch.index.engine.InternalEngine.refresh(InternalEngine.java:1569)
org.elasticsearch.index.engine.InternalEngine.refresh(InternalEngine.java:1550)
org.elasticsearch.index.shard.IndexShard.refresh(IndexShard.java:903)
org.elasticsearch.index.IndexService.maybeRefreshEngine(IndexService.java:719)
org.elasticsearch.index.IndexService.access$400(IndexService.java:100)
org.elasticsearch.index.IndexService$AsyncRefreshTask.runInternal(IndexService.java:921)
org.elasticsearch.index.IndexService$BaseAsyncTask.run(IndexService.java:831)
org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
6/10 snapshots sharing following 24 elements
org.apache.lucene.index.StandardDirectoryReader.doOpenFromWriter(StandardDirectoryReader.java:294)
org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:269)
org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:259)
org.apache.lucene.index.FilterDirectoryReader.doOpenIfChanged(FilterDirectoryReader.java:112)
org.apache.lucene.index.DirectoryReader.openIfChanged(DirectoryReader.java:140)
org.apache.lucene.search.SearcherManager.refreshIfNeeded(SearcherManager.java:156)
org.apache.lucene.search.SearcherManager.refreshIfNeeded(SearcherManager.java:58)
org.apache.lucene.search.ReferenceManager.doMaybeRefresh(ReferenceManager.java:176)
org.apache.lucene.search.ReferenceManager.maybeRefreshBlocking(ReferenceManager.java:253)
org.elasticsearch.index.engine.InternalEngine$ExternalSearcherManager.refreshIfNeeded(InternalEngine.java:322)
org.elasticsearch.index.engine.InternalEngine$ExternalSearcherManager.refreshIfNeeded(InternalEngine.java:297)
org.apache.lucene.search.ReferenceManager.doMaybeRefresh(ReferenceManager.java:176)
org.apache.lucene.search.ReferenceManager.maybeRefreshBlocking(ReferenceManager.java:253)
org.elasticsearch.index.engine.InternalEngine.refresh(InternalEngine.java:1569)
org.elasticsearch.index.engine.InternalEngine.refresh(InternalEngine.java:1550)
org.elasticsearch.index.shard.IndexShard.refresh(IndexShard.java:903)
org.elasticsearch.index.IndexService.maybeRefreshEngine(IndexService.java:719)
org.elasticsearch.index.IndexService.access$400(IndexService.java:100)
org.elasticsearch.index.IndexService$AsyncRefreshTask.runInternal(IndexService.java:921)
org.elasticsearch.index.IndexService$BaseAsyncTask.run(IndexService.java:831)
org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
and
25.0% (125ms out of 500ms) cpu usage by thread 'elasticsearch[ELASTIC-SRV1][write][T#1]'
3/10 snapshots sharing following 2 elements
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
On my elastic node, I have high writing operations, from the logs of our applications to the logs filebeat and metricbeat send from 3 different servers. The read operation is not crucial at this stage for us, but the write is.
I have also changed the refresh_interval from 3 seconds (the default value) to 30 seconds for each index, but the CPU usage has not changed significantly.
Could you please tell me the way I can reduce the CPU usage?