# Elasticsearch High CPU usage

**URL:** <https://discuss.elastic.co/t/elasticsearch-high-cpu-usage/352998>\
**Category:** Elasticsearch\
**Created:** [February 10, 2024, 5:35pm UTC](https://discuss.elastic.co/t/elasticsearch-high-cpu-usage/352998 "2024-02-10T17:35:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkkk7](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@kkkk7](https://discuss.elastic.co/u/kkkk7)\
**Post date:** [February 10, 2024, 5:35pm UTC](https://discuss.elastic.co/t/elasticsearch-high-cpu-usage/352998/1 "2024-02-10T17:35:39Z")

</div>

Hello

I'm using version 7.3.2 (this is a project since 2019 so a bit old version)  
After a years pass by my elastic stack CPU usage very high so we decide extends the CPU core but seem like the usage will growth bigger and bigger

My use case is just website search with \_all on 9 index and total data not more than 75k row

Are these cause of my query ? or my elastic version is too old ? or this is the normal CPU usage of Elasticsearch

thanks for your help!

Here is some info:

Hot Threads

```auto
::: {el1.xxx}{4Lg53tv3SpG5aqxJxeNIsQ}{7FyEC9R3S6uFQ2aO6ntZKw}{172.31.1.88}{172.31.1.88:9300}{dim}{ml.machine_memory=33731186688, xpack.installed=true, ml.max_open_jobs=20}
   Hot threads at 2024-02-10T17:20:42.703Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
   
   33.9% (169.3ms out of 500ms) cpu usage by thread 'elasticsearch[el1.xxx][http_server_worker][T#2]'
     2/10 snapshots sharing following 7 elements
       io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:1073)
       io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
       io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405)
       io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
       io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       java.base@12.0.2/java.lang.Thread.run(Thread.java:835)
     3/10 snapshots sharing following 9 elements
       java.base@12.0.2/sun.nio.ch.EPoll.wait(Native Method)
       java.base@12.0.2/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
       java.base@12.0.2/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
       java.base@12.0.2/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
       io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:791)
       io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:439)
       io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       java.base@12.0.2/java.lang.Thread.run(Thread.java:835)
   
   28.3% (141.4ms out of 500ms) cpu usage by thread 'elasticsearch[el1.xxx][http_server_worker][T#4]'
     2/10 snapshots sharing following 19 elements
       io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
       io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
       io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
       io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287)
       io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
       io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
       io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
       io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
       io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
       io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
       io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
       io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
       io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
       io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:582)
       io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:536)
       io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
       io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       java.base@12.0.2/java.lang.Thread.run(Thread.java:835)
     8/10 snapshots sharing following 9 elements
       java.base@12.0.2/sun.nio.ch.EPoll.wait(Native Method)
       java.base@12.0.2/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
       java.base@12.0.2/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
       java.base@12.0.2/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
       io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:791)
       io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:439)
       io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       java.base@12.0.2/java.lang.Thread.run(Thread.java:835)
   
   26.9% (134.2ms out of 500ms) cpu usage by thread 'elasticsearch[el1.xxx][http_server_worker][T#1]'
     2/10 snapshots sharing following 7 elements
       io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
       io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:582)
       io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:536)
       io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
       io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       java.base@12.0.2/java.lang.Thread.run(Thread.java:835)
     3/10 snapshots sharing following 9 elements
       java.base@12.0.2/sun.nio.ch.EPoll.wait(Native Method)
       java.base@12.0.2/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
       java.base@12.0.2/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
       java.base@12.0.2/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
       io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:791)
       io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:439)
       io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       java.base@12.0.2/java.lang.Thread.run(Thread.java:835)

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/d/2da1c0349f34b6c1ab03b230395979a3f8af05e2.jpeg)

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 10, 2024, 7:12pm UTC](https://discuss.elastic.co/t/elasticsearch-high-cpu-usage/352998/2 "2024-02-10T19:12:25Z")

</div>

Hello,

Where is the high CPU usage? The screenshot you shared does not show any high CPU usage, the highest load is the 15 min average, which is 1.75, which is low for a 8 core CPU machine.

---

<div class="post-metadata">

**Author:** ![kkkk7](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@kkkk7](https://discuss.elastic.co/u/kkkk7)\
**Post date:** [February 11, 2024, 2:54am UTC](https://discuss.elastic.co/t/elasticsearch-high-cpu-usage/352998/3 "2024-02-11T02:54:59Z")

</div>

My apologies that capture at the night low traffic time, Actually we want to reduce our spec, Last month it's peak to 100% and we have try reset all index and it's reduce to maximum at 80% in a day time but we afraid that It will growth up again in the future.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 10, 2024, 2:55am UTC](https://discuss.elastic.co/t/elasticsearch-high-cpu-usage/352998/4 "2024-03-10T02:55:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
