# Logstash on k8s - high memory usage

**URL:** <https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299>\
**Category:** Logstash\
**Created:** [July 15, 2020, 1:07pm UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299 "2020-07-15T13:07:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachshani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zachshani/32/72189_2.png) [@zachshani](https://discuss.elastic.co/u/zachshani)\
**Post date:** [July 15, 2020, 1:07pm UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299/1 "2020-07-15T13:07:39Z")

</div>

Hi,  
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.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 15, 2020, 5:44pm UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299/2 "2020-07-15T17:44:26Z")

</div>

> [@zachshani](#):
>
> I've noticed that it consumes high memory

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.

---

<div class="post-metadata">

**Author:** ![tbege](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@tbege](https://discuss.elastic.co/u/tbege)\
**Post date:** [July 16, 2020, 7:56am UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299/3 "2020-07-16T07:56:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zachshani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zachshani/32/72189_2.png) [@zachshani](https://discuss.elastic.co/u/zachshani)\
**Post date:** [July 16, 2020, 4:14pm UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299/4 "2020-07-16T16:14:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 16, 2020, 5:45pm UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299/5 "2020-07-16T17:45:24Z")

</div>

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

---

<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:** [August 13, 2020, 5:45pm UTC](https://discuss.elastic.co/t/logstash-on-k8s-high-memory-usage/241299/6 "2020-08-13T17:45:32Z")

</div>

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