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 setting the heap memory that will be allocated to elasticsearch java process.
We can set Environment Variable as follows
ES_HEAP_SIZE
4g
We can check allocated memory using service manager of elasticsearch as follows
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 are 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
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 repository of elastic.
One thought on “Setting Elasticsearch Heap Size in Windows”