# Elasticsearch rpm and configuring garbage collection

**URL:** <https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202>\
**Category:** Elasticsearch\
**Created:** [April 25, 2014, 4:09pm UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202 "2014-04-25T16:09:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jilles\_van\_Gurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jilles_van_gurp/32/879_2.png) [@Jilles\_van\_Gurp](https://discuss.elastic.co/u/Jilles_van_Gurp)\
**Post date:** [April 25, 2014, 4:09pm UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202/1 "2014-04-25T16:09:28Z")

</div>

I've been using the elasticsearch rpms (1.1.1) on our centos 6.5 setup and  
I've been wondering about the recommended way to configure it given that it  
deploys an init.d script with defaults.

I figured out that I can use /etc/sysconfig/elasticsearch for things like  
heap size. However, /usr/share/elasticsearch/bin/elasticsearch.in.sh  
configures some defaults for garbage collection:

JAVA\_OPTS="$JAVA\_OPTS -XX:+UseParNewGC"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+UseConcMarkSweepGC"

JAVA\_OPTS="$JAVA\_OPTS -XX:CMSInitiatingOccupancyFraction=75"  
JAVA\_OPTS="$JAVA\_OPTS -XX:+UseCMSInitiatingOccupancyOnly"

So, I'm getting some default configuration for garbage collection that I  
probably should be tuning; especially given that it is running out of  
memory after a few weeks on our setup with kibana and a rather large amount  
of logstash indices (over 200GB).

Is it possible to have a custom garbage collection strategy without  
modifying files deployed and overwritten by the rpm? elasticsearch.in.sh  
seems specific to the 1.1.1 version given that it also includes the  
classpath definition.

In any case, it might be handy to clarify the recommended way to configure  
elasticsearch when deployed using the rpm as opposed to a developer machine  
with a tar ball. Most documentation I'm finding seems to assume the latter.

Jilles

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [April 28, 2014, 6:58am UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202/2 "2014-04-28T06:58:03Z")

</div>

Hi Jilles,

Any idea on why you're running out of memory? You can monitor stuff like  
field, filter caches and memory pools to get some clues.

I would assume your problem is because field data is accumulating, and not  
because of GC settings. Depending on how much heap, how many nodes you  
have, and how much heap is used for other things, I'd limit that a slice of  
the total memory (for example, 30%).

## Best regards, Radu

Performance Monitoring \* Log Analytics \* Search Analytics  
Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)

On Fri, Apr 25, 2014 at 7:09 PM, Jilles van Gurp [jillesvangurp@gmail.com](mailto:jillesvangurp@gmail.com)wrote:

> I've been using the elasticsearch rpms (1.1.1) on our centos 6.5 setup and  
> I've been wondering about the recommended way to configure it given that it  
> deploys an init.d script with defaults.
> 
> I figured out that I can use /etc/sysconfig/elasticsearch for things like  
> heap size. However, /usr/share/elasticsearch/bin/elasticsearch.in.shconfigures some defaults for garbage collection:
> 
> JAVA\_OPTS="$JAVA\_OPTS -XX:+UseParNewGC"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+UseConcMarkSweepGC"
> 
> JAVA\_OPTS="$JAVA\_OPTS -XX:CMSInitiatingOccupancyFraction=75"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
> 
> So, I'm getting some default configuration for garbage collection that I  
> probably should be tuning; especially given that it is running out of  
> memory after a few weeks on our setup with kibana and a rather large amount  
> of logstash indices (over 200GB).
> 
> Is it possible to have a custom garbage collection strategy without  
> modifying files deployed and overwritten by the rpm? elasticsearch.in.shseems specific to the 1.1.1 version given that it also includes the  
> classpath definition.
> 
> In any case, it might be handy to clarify the recommended way to configure  
> elasticsearch when deployed using the rpm as opposed to a developer machine  
> with a tar ball. Most documentation I'm finding seems to assume the latter.
> 
> Jilles
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHXA0\_0h10irKcsRU%3DPDu5DrVPACnSq01sZestFYrwftqze%3DAg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHXA0_0h10irKcsRU%3DPDu5DrVPACnSq01sZestFYrwftqze%3DAg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jilles\_van\_Gurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jilles_van_gurp/32/879_2.png) [@Jilles\_van\_Gurp](https://discuss.elastic.co/u/Jilles_van_Gurp)\
**Post date:** [April 28, 2014, 7:22am UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202/3 "2014-04-28T07:22:43Z")

</div>

Sounds like that could be the cause. What setting would I need to configure  
for this? Regardless, I'd like to know where to start with configuring  
garbage collection for ES.

Jilles

On Monday, April 28, 2014 8:58:03 AM UTC+2, Radu Gheorghe wrote:

> Hi Jilles,
> 
> Any idea on why you're running out of memory? You can monitor stuff like  
> field, filter caches and memory pools to get some clues.
> 
> I would assume your problem is because field data is accumulating, and not  
> because of GC settings. Depending on how much heap, how many nodes you  
> have, and how much heap is used for other things, I'd limit that a slice of  
> the total memory (for example, 30%).
> 
> ## Best regards, Radu
> 
> Performance Monitoring \* Log Analytics \* Search Analytics  
> Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)
> 
> On Fri, Apr 25, 2014 at 7:09 PM, Jilles van Gurp \<[jilles...@gmail.com](mailto:jilles...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I've been using the elasticsearch rpms (1.1.1) on our centos 6.5 setup  
> > and I've been wondering about the recommended way to configure it given  
> > that it deploys an init.d script with defaults.
> > 
> > I figured out that I can use /etc/sysconfig/elasticsearch for things like  
> > heap size. However, /usr/share/elasticsearch/bin/elasticsearch.in.shconfigures some defaults for garbage collection:
> > 
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+UseParNewGC"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+UseConcMarkSweepGC"
> > 
> > JAVA\_OPTS="$JAVA\_OPTS -XX:CMSInitiatingOccupancyFraction=75"  
> > JAVA\_OPTS="$JAVA\_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
> > 
> > So, I'm getting some default configuration for garbage collection that I  
> > probably should be tuning; especially given that it is running out of  
> > memory after a few weeks on our setup with kibana and a rather large amount  
> > of logstash indices (over 200GB).
> > 
> > Is it possible to have a custom garbage collection strategy without  
> > modifying files deployed and overwritten by the rpm? elasticsearch.in.shseems specific to the 1.1.1 version given that it also includes the  
> > classpath definition.
> > 
> > In any case, it might be handy to clarify the recommended way to  
> > configure elasticsearch when deployed using the rpm as opposed to a  
> > developer machine with a tar ball. Most documentation I'm finding seems to  
> > assume the latter.
> > 
> > Jilles
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8cb48df2-779f-4954-bd12-8677be19075a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cb48df2-779f-4954-bd12-8677be19075a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [April 28, 2014, 9:48am UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202/4 "2014-04-28T09:48:24Z")

</div>

Hi,

The setting is indices.fielddata.cache.size. You can check out the docs for  
more options, like adjusting the circuit breaker:

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

To change the GC settings, I usually edit the in.sh script. You have an  
interesting point, that it might be overridden by a RPM upgrade. I'm not  
aware of a way to override them, maybe somebody else is.

## Best regards, Radu

Performance Monitoring \* Log Analytics \* Search Analytics  
Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)

On Mon, Apr 28, 2014 at 10:22 AM, Jilles van Gurp  
[jillesvangurp@gmail.com](mailto:jillesvangurp@gmail.com)wrote:

> Sounds like that could be the cause. What setting would I need to  
> configure for this? Regardless, I'd like to know where to start with  
> configuring garbage collection for ES.
> 
> Jilles
> 
> On Monday, April 28, 2014 8:58:03 AM UTC+2, Radu Gheorghe wrote:
> 
> > Hi Jilles,
> > 
> > Any idea on why you're running out of memory? You can monitor stuff like  
> > field, filter caches and memory pools to get some clues.
> > 
> > I would assume your problem is because field data is accumulating, and  
> > not because of GC settings. Depending on how much heap, how many nodes you  
> > have, and how much heap is used for other things, I'd limit that a slice of  
> > the total memory (for example, 30%).
> > 
> > ## Best regards, Radu
> > 
> > Performance Monitoring \* Log Analytics \* Search Analytics  
> > Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)
> > 
> > On Fri, Apr 25, 2014 at 7:09 PM, Jilles van Gurp [jilles...@gmail.com](mailto:jilles...@gmail.com)wrote:
> > 
> > > I've been using the elasticsearch rpms (1.1.1) on our centos 6.5 setup  
> > > and I've been wondering about the recommended way to configure it given  
> > > that it deploys an init.d script with defaults.
> > > 
> > > I figured out that I can use /etc/sysconfig/elasticsearch for things  
> > > like heap size. However, /usr/share/elasticsearch/bin/elasticsearc  
> > > h.in.sh configures some defaults for garbage collection:
> > > 
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+UseParNewGC"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+UseConcMarkSweepGC"
> > > 
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:CMSInitiatingOccupancyFraction=75"  
> > > JAVA\_OPTS="$JAVA\_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
> > > 
> > > So, I'm getting some default configuration for garbage collection that I  
> > > probably should be tuning; especially given that it is running out of  
> > > memory after a few weeks on our setup with kibana and a rather large amount  
> > > of logstash indices (over 200GB).
> > > 
> > > Is it possible to have a custom garbage collection strategy without  
> > > modifying files deployed and overwritten by the rpm? elasticsearch.in.shseems specific to the 1.1.1 version given that it also includes the  
> > > classpath definition.
> > > 
> > > In any case, it might be handy to clarify the recommended way to  
> > > configure elasticsearch when deployed using the rpm as opposed to a  
> > > developer machine with a tar ball. Most documentation I'm finding seems to  
> > > assume the latter.
> > > 
> > > Jilles
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%  
> > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/182eb657-9503-42f6-8007-41150143fe46%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/8cb48df2-779f-4954-bd12-8677be19075a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cb48df2-779f-4954-bd12-8677be19075a%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/8cb48df2-779f-4954-bd12-8677be19075a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8cb48df2-779f-4954-bd12-8677be19075a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHXA0\_3ex3uw5A2o6XCHbf75KirG4yGoHawbt2Com05G1Cfj4A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHXA0_3ex3uw5A2o6XCHbf75KirG4yGoHawbt2Com05G1Cfj4A%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Michael\_Salmon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_salmon/32/5330_2.png) [@Michael\_Salmon](https://discuss.elastic.co/u/Michael_Salmon)\
**Post date:** [April 28, 2014, 10:06am UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202/5 "2014-04-28T10:06:16Z")

</div>

On Friday, 25 April 2014 18:09:28 UTC+2, Jilles van Gurp wrote:

> I've been using the elasticsearch rpms (1.1.1) on our centos 6.5 setup and  
> I've been wondering about the recommended way to configure it given that it  
> deploys an init.d script with defaults.
> 
> I figured out that I can use /etc/sysconfig/elasticsearch for things like  
> heap size. However, /usr/share/elasticsearch/bin/elasticsearch.in.shconfigures some defaults for garbage collection:
> 
> JAVA\_OPTS="$JAVA\_OPTS -XX:+UseParNewGC"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+UseConcMarkSweepGC"
> 
> JAVA\_OPTS="$JAVA\_OPTS -XX:CMSInitiatingOccupancyFraction=75"  
> JAVA\_OPTS="$JAVA\_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
> 
> So, I'm getting some default configuration for garbage collection that I  
> probably should be tuning; especially given that it is running out of  
> memory after a few weeks on our setup with kibana and a rather large amount  
> of logstash indices (over 200GB).
> 
> Is it possible to have a custom garbage collection strategy without  
> modifying files deployed and overwritten by the rpm? elasticsearch.in.shseems specific to the 1.1.1 version given that it also includes the  
> classpath definition.
> 
> In any case, it might be handy to clarify the recommended way to configure  
> elasticsearch when deployed using the rpm as opposed to a developer machine  
> with a tar ball. Most documentation I'm finding seems to assume the latter.
> 
> Jilles

The way I handle configuration with rpms is to create a special directory  
with config files for each cluster and then start the cluster pointing out  
the config file to be used with -Des.config. In that config file I point  
out the directory to be used for config with path.conf so that logging.yml  
can be found. I also use a special start script so that I can run ulimit  
and set a few parameters before starting es.

/Michael

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3e4cf550-5d23-4a16-8ae3-d75489efca36%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3e4cf550-5d23-4a16-8ae3-d75489efca36%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:33am UTC](https://discuss.elastic.co/t/elasticsearch-rpm-and-configuring-garbage-collection/17202/6 "2017-07-06T01:33:09Z")

</div>


