# HEAP size change

**URL:** <https://discuss.elastic.co/t/heap-size-change/10126>\
**Category:** Elasticsearch\
**Created:** [December 20, 2012, 1:09am UTC](https://discuss.elastic.co/t/heap-size-change/10126 "2012-12-20T01:09:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_Hilkert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_hilkert/32/2182_2.png) [@Brandon\_Hilkert](https://discuss.elastic.co/u/Brandon_Hilkert)\
**Post date:** [December 20, 2012, 1:09am UTC](https://discuss.elastic.co/t/heap-size-change/10126/1 "2012-12-20T01:09:23Z")

</div>

Version: 0.19.4

What is the right way to update the heap size?

I've tried exporting the following keys:

export ES\_HEAP\_SIZE=4g  
export ES\_MIN\_MEM=4g  
export ES\_MAX\_MEM=4g

But don't see anything different tacked on to the end of the process. Any  
ideas?

ubuntu@ip-10-12-185-166:/etc/elasticsearch$ ps ax | grep elasticsearch  
1554 ? Sl 0:15 /usr/lib/jvm/java-6-openjdk-amd64//bin/java  
-Xms256m -Xmx1g -Xss256k -XX:+UseParNewGC -XX:+UseConcMarkSweepGC  
-XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly  
-XX:+HeapDumpOnOutOfMemoryError -Delasticsearch  
-Des.pidfile=/var/run/elasticsearch.pid  
-Des.path.home=/usr/share/elasticsearch -cp  
:/usr/share/elasticsearch/lib/_:/usr/share/elasticsearch/lib/sigar/_  
-Des.config=/etc/elasticsearch/elasticsearch.yml  
-Des.path.home=/usr/share/elasticsearch  
-Des.path.logs=/var/log/elasticsearch -Des.path.data=/var/lib/elasticsearch  
-Des.path.work=/tmp/elasticsearch -Des.path.conf=/etc/elasticsearch  
org.elasticsearch.bootstrap.ElasticSearch

--

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 20, 2012, 6:20am UTC](https://discuss.elastic.co/t/heap-size-change/10126/2 "2012-12-20T06:20:00Z")

</div>

Are you using the service wrapper? The settings look correct. You shouldn't  
need to set the min and max since ES\_HEAP\_SIZE already sets both  
automatically.

--  
Ivan

On Wed, Dec 19, 2012 at 5:09 PM, Brandon Hilkert [brandon@meeteor.com](mailto:brandon@meeteor.com)wrote:

> 1554 ? Sl 0:15 /usr/lib/jvm/java-6-openjdk-amd64//bin/java  
> -Xms256m -Xmx1g -Xss256k -XX:+UseParNewGC -XX:+UseConcMarkSweepGC  
> -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly  
> -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch  
> -Des.pidfile=/var/run/elasticsearch.pid  
> -Des.path.home=/usr/share/elasticsearch -cp  
> :/usr/share/elasticsearch/lib/_:/usr/share/elasticsearch/lib/sigar/_  
> -Des.config=/etc/elasticsearch/elasticsearch.yml  
> -Des.path.home=/usr/share/elasticsearch  
> -Des.path.logs=/var/log/elasticsearch -Des.path.data=/var/lib/elasticsearch  
> -Des.path.work=/tmp/elasticsearch -Des.path.conf=/etc/elasticsearch  
> org.elasticsearch.bootstrap.Elasticsearch

--

---

<div class="post-metadata">

**Author:** ![karmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karmi/32/44951_2.png) [@karmi](https://discuss.elastic.co/u/karmi)\
**Post date:** [December 20, 2012, 8:46am UTC](https://discuss.elastic.co/t/heap-size-change/10126/3 "2012-12-20T08:46:07Z")

</div>

> What is the right way to update the heap size?

Using the ES\_HEAP\_SIZE is reccomended. For the settings to be applied, it  
depends on how you launch the Elasticsearch process. The service wrapper  
takes this variable into account, as well as the `elasticsearch` script.  
Many provisioning scripts set these values directly in the  
[https://github.com/elasticsearch/elasticsearch/blob/master/bin/elasticsearch.in.sh](https://github.com/elasticsearch/elasticsearch/blob/master/bin/elasticsearch.in.sh)  
file.

The most safe to have this setting applied is to pass it to the environment  
when you launch the process:

```
$ ES_HEAP_SIZE=512m elasticsearch -f
$ ... initializing ...
$ ps aux | grep java
$ 40315 ... 

```

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java  
-Xms512m -Xmx512m ... org.elasticsearch.bootstrap.Elasticsearch

Karel

--

---

<div class="post-metadata">

**Author:** ![Brandon\_Hilkert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_hilkert/32/2182_2.png) [@Brandon\_Hilkert](https://discuss.elastic.co/u/Brandon_Hilkert)\
**Post date:** [December 20, 2012, 12:30pm UTC](https://discuss.elastic.co/t/heap-size-change/10126/4 "2012-12-20T12:30:02Z")

</div>

I do have the service wrapper installed. ES is started with the OS  
(Ubuntu). I usually run "sudo service elasticsearch restart" from the  
command line. I realized the service wrapper installed a scripte into  
/etc/init.d/elasticsearch when i "installed" the service. That file  
contained the references to the ES\_HEAP\_SIZE variable. I set the value in  
there and it worked. Not sure why it doesn't with the ENV variable.

On Thu, Dec 20, 2012 at 3:46 AM, Karel Minařík [karel.minarik@gmail.com](mailto:karel.minarik@gmail.com)wrote:

> What is the right way to update the heap size?
> 
> > 
> 
> Using the ES\_HEAP\_SIZE is reccomended. For the settings to be applied, it  
> depends on how you launch the Elasticsearch process. The service wrapper  
> takes this variable into account, as well as the `elasticsearch` script.  
> Many provisioning scripts set these values directly in the \<  
> [https://github.com/elasticsearch/elasticsearch/blob/master/bin/elasticsearch.in.sh](https://github.com/elasticsearch/elasticsearch/blob/master/bin/elasticsearch.in.sh)\>  
> file.
> 
> The most safe to have this setting applied is to pass it to the  
> environment when you launch the process:
> 
> ```
> $ ES_HEAP_SIZE=512m elasticsearch -f
> $ ... initializing ...
> $ ps aux | grep java
> $ 40315 ...
> 
> ```
> 
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java  
> -Xms512m -Xmx512m ... org.elasticsearch.bootstrap.Elasticsearch
> 
> Karel
> 
> --

--

---

<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, 2:59am UTC](https://discuss.elastic.co/t/heap-size-change/10126/5 "2017-07-06T02:59:06Z")

</div>


