High CPU usage after GC?


(Patrick Rainier Juen) #1

I got alerted that our CPU usage is high and according to some metrics elasticsearch is consuming cpu. This was the last log of elasticsearch, but it's still working fine though

[INFO ][o.e.m.j.JvmGcMonitorService] [iJXOMG0] [gc][2923498] overhead, spent [261ms] collecting in the last [1s]

Shortly after this, the alert triggered

Another thing is that the last time this log showed the number seems to be small

[o.e.m.j.JvmGcMonitorService] [iJXOMG0] [gc][304] overhead, spent [272ms] collecting in the last [1s]

How could I lower down the CPU usage?

Elasticsearch is running on docker and I have set ES_JAVA_OPTS: "-Xmx512m -Xms512m"


(Ben Martineau) #2

Is your Elasticsearch Instance is running as Master/Client & Data in the same container ?

Because 512Mb is really not enought to run a one node ELK Stack.

To be safe in you case, put at least 2G for the container.

Edit : May you have to increase your CPU's


(Patrick Rainier Juen) #3

Yes it is. I could increase the heap size but the issue here though is that it was consuming almost 0% cpu before this


(Ben Martineau) #4

Mhm, what were the last tasks elastic run ?

Looks something happen to consuming from 0% to 50% AVG.

Log's aren't tell what kind of event could be the fault ? (Execpt 2 lines)


(Patrick Rainier Juen) #5

How could I know that?


(Ben Martineau) #6

You could get more information from Elastic logs, at leasts more details


(Patrick Rainier Juen) #7

Doesn't the logs go out into STDOUT? If so then the last logs of elasticsearch are the one I have posted originally. If there is a different file that elasticsearch logs into then I would appreciate it if you could help me find it.


(Patrick Rainier Juen) #8

This is the contents of my log4j2 file

status = error

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console

This means that the logs are output into the console right?


(Patrick Rainier Juen) #9

Hi, I really need help on this. I could probably just restart my elasticsearch instance to solve this problem but I want to know what caused this.


(system) #10

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