Logstash on k8s - high memory usage

I'm implementing logstash as a deployment (pod) on k8s.
I've noticed that it consumes high memory - even when no data is being send to it.
I've tried setting jvm.options (Xms4g & Xmx4g), but I got same results - high memory.
Is it normal behavior? or am I missing something?

  • I have one pipeline and I'm using grok filter.

What do you mean by that? The way Java works is that it its utilization of the heap will grow until it runs out of space, then it will run garbage collection to free up space. So if you tell it it can use up to 4 GB it will likely grow to 4 GB. If you want it to run in less memory then configure it that way.

The default Logstash usage is Xmx1g and Xms1g. If I am not mistaken, there are 2 ways to change that, either the jvm options or the Logstash config directly. (I am using Helm for example and specify the values in the deployment yaml).

As @Badger said, if you start it, with 4G, it will likely grow to that size no matter what.

Thanks for the reply.
So, basically the minimum memory amount is 1g?

No, that is not the minimum. I do not have 1G of memory on the machine I run logstash on, so I run it with -Xms400m -Xmx500m

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