Setting Elasticsearch Heap Size in Windows

Elasticsearch has an option to configure the memory which is used by elasticsearch java process.

The memory can be configured using various Environmental Variables.

The default Heap Size of an elasticsearch process in 1gb. The ES_HEAP_SIZE environment variable allows to set the heap memory that will be allocated to elasticsearch java process.

We can set Environment Variable as fololows

ES_HEAP_SIZE
4g

 

We can check allocated memory using service manager of elasticsearch as follows

cmd

 

manager

 

And another option is to lock the process address space into RAM, preventing any Elasticsearch memory from being swapped out by configuring as follows in Elasticsearch configuration file (config/elasticsearch.yml)

bootstrap.mlockall: true

 

We can check whether settings is applied to the nodes or not by using any one of the following commands

curl http://localhost:9200/_nodes/process?pretty
GET /_nodes/process?pretty
If we receive mlockall is false by running above commands, then it means that the the mlockall request has failed.
Explore data using Elastic 🙂
 
 
Note:
Note that the environment configuration options available during the installation are copied and will be used during the service life cycle. This means any changes made to them after the installation will not be picked up unless the service is reinstalled.
 

Elasticsearch is having some minor issue in locking the memory(using Virtual lock) in Windows OS; there is already an open issue raised in Github repos of elastic.

 

Advertisements

One thought on “Setting Elasticsearch Heap Size in Windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s