# Jvm.options - elasticsearch and logstash?

**URL:** <https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817>\
**Category:** Logstash\
**Created:** [July 26, 2018, 4:24pm UTC](https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817 "2018-07-26T16:24:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Chase](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s_chase/32/33237_2.png) [@S\_Chase](https://discuss.elastic.co/u/S_Chase)\
**Post date:** [July 26, 2018, 4:24pm UTC](https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817/1 "2018-07-26T16:24:54Z")

</div>

I was getting some JVM Heap errors and I was looking up on how to set all of that properly. I saw in ES documentation to set it at 50% of available memory (I have 8G total) up to 32G. But which one do I set - LS or ES or both? Do they need to be identical or 50% of 50% in each?

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [July 26, 2018, 8:14pm UTC](https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817/2 "2018-07-26T20:14:42Z")

</div>

Logstash shouldn't need as much heap, I have 2G, 8 pipelines (3 active) with about 500 events per second. It probably depends what you do in the pipelines.

---

<div class="post-metadata">

**Author:** ![davemoore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davemoore/32/134233_2.png) [@davemoore](https://discuss.elastic.co/u/davemoore)\
**Post date:** [July 26, 2018, 9:34pm UTC](https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817/3 "2018-07-26T21:34:37Z")

</div>

@S_Chase

Elasticsearch and Logstash have different memory requirements.

You're correct that the recommended JVM Heap allocation for Elasticsearch is 50% of available memory (up to 32GB) and it will use the remaining memory for caching, which improves query performance.

Logstash uses memory differently and usually requires less than Elasticsearch. Logstash is essentially a data processing queue. It holds small batches of events in memory before processing them and shipping them to Elasticsearch. Many installations use the default 1GB. You may need to increase this if you plan to hold more events in the queue at once, or if you plan to use a large [translation dictionary](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html).

See also this discussion: [Logstash OOM - understanding heap sizing](https://discuss.elastic.co/t/logstash-oom-understanding-heap-sizing/103495/10?u=davemoore)

---

<div class="post-metadata">

**Author:** ![S\_Chase](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s_chase/32/33237_2.png) [@S\_Chase](https://discuss.elastic.co/u/S_Chase)\
**Post date:** [August 14, 2018, 1:37pm UTC](https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817/4 "2018-08-14T13:37:54Z")

</div>

thank you, I ended up - for now - setting both ES and LS with the same amount of memory and it resolved the heap errors.

---

<div class="post-metadata">

**Author:** ![davemoore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davemoore/32/134233_2.png) [@davemoore](https://discuss.elastic.co/u/davemoore)\
**Post date:** [August 17, 2018, 1:12pm UTC](https://discuss.elastic.co/t/jvm-options-elasticsearch-and-logstash/141817/5 "2018-08-17T13:12:01Z")

</div>


