# What is the recommend memory size to run logstash?

**URL:** <https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083>\
**Category:** Logstash\
**Created:** [April 23, 2021, 11:52am UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083 "2021-04-23T11:52:34Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [April 23, 2021, 11:52am UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/1 "2021-04-23T11:52:34Z")

</div>

Hi all,

Please explain What is the recommend memory size to run logstash.

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:** [April 23, 2021, 2:14pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/2 "2021-04-23T14:14:46Z")

</div>

> [@talbehat](#):
>
> What is the recommend memory size to run logstash.

That really depends on your use case. I routinely run logstash with a 400 MB heap on a server with 2 GB of memory. Some folk use 2GB or 4GB heap, some much more.

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [April 23, 2021, 4:07pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/3 "2021-04-23T16:07:07Z")

</div>

can it be 256 mb as per my need without OOM? Yes how can I do?

---

<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:** [April 23, 2021, 4:16pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/4 "2021-04-23T16:16:58Z")

</div>

I doubt that you could run with a heap as small as 256MB, but you could try it.

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [April 30, 2021, 4:53pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/5 "2021-04-30T16:53:36Z")

</div>

In my case, logstash taking 550MB memory, so how can I reduce memory size upto some mb like 350 MB.

I have set 256m minimum and maximum in jvm.option file

---

<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:** [April 30, 2021, 5:14pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/6 "2021-04-30T17:14:24Z")

</div>

Java uses a lot of memory that is not heap. The mx and sx options only control the heap size. The rest is not adjustable. With a minimal configuration I can take the heap size down to 128 MB. The virtual size of the java process is then 2.4 GB, and the RSS is 390 MB.

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [May 1, 2021, 8:10am UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/7 "2021-05-01T08:10:05Z")

</div>

@Badger, when I down to 128 MB heap, logstash is giving OOM error. i.e outofmemory error.

is there any way to reduce logstash plugins size which also taking more memory. I mean install that plugins only which I am using in configuration. Like logstash-file-input, logstash-output-elasticsearch.

---

<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:** [May 1, 2021, 3:30pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/8 "2021-05-01T15:30:36Z")

</div>

> [@talbehat](#):
>
> is there any way to reduce logstash plugins size which also taking more memory.

Not that I know of. logstash only loads the plugins that the configuration uses.

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [May 2, 2021, 10:22am UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/9 "2021-05-02T10:22:01Z")

</div>

> [@Badger](#):
>
> Not that I know of. logstash only loads the plugins that the configuration uses.

Because of ruby is dynamic, so this statement is true.

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [May 2, 2021, 3:55pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/10 "2021-05-02T15:55:05Z")

</div>

> [@Badger](#):
>
> Java uses a lot of memory that is not heap

One thing, I am not getting understand that I am setting heap size maximum and minimum with 256m, but it is going upto 500m.

is there any concepts behind that?

---

<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:** [May 2, 2021, 3:58pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/11 "2021-05-02T15:58:57Z")

</div>

How are you measuring the memory size?

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [May 2, 2021, 4:40pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/12 "2021-05-02T16:40:46Z")

</div>

> [@Badger](#):
>
> How are you measuring the memory size?

Using linux command `top -p <logstash-pid>`

and checking column mem%, it is taking around 3.2% of 16gb RAM = ~500MB

And defining as in jvm.option,

`-Xms256m -Xmx256m -Xss1m`

---

<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:** [May 2, 2021, 5:00pm UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/13 "2021-05-02T17:00:00Z")

</div>

The memory used by the heap can be a small percentage of the memory used by the JVM. The JVM requires hundreds of megabytes of non-heap memory. See [this](https://spring.io/blog/2019/03/11/memory-footprint-of-the-jvm) post, or Google "java non-heap memory".

Some JVMs have options to size some of the non-heap components, but typically this kind of tuning is more work than it is worth.

---

<div class="post-metadata">

**Author:** ![talbehat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talbehat/32/84367_2.png) [@talbehat](https://discuss.elastic.co/u/talbehat)\
**Post date:** [May 3, 2021, 8:47am UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/14 "2021-05-03T08:47:46Z")

</div>

Thank you, @Badger for reply

---

<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:** [May 31, 2021, 8:48am UTC](https://discuss.elastic.co/t/what-is-the-recommend-memory-size-to-run-logstash/271083/15 "2021-05-31T08:48:33Z")

</div>

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