Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set memory limit to ElasticSearch in Windows?

Is there any possible to limit ElasticSearch working set memory on a windows server 2008 R2?

I tried everything online, but nothing seem to work.

Tried to set (environment vars): ES_MIN_MEM ES_MAX_MEM ES_HEAP_SIZE

In the java service: -Xms15g -Xmx15g -Xss256k

In the YML file: bootstrap.mlockall: true

Any idea what am I doing wrong, or if its possible at all to limit RAM in a Windows service?

Thanks!

like image 861
m0fo Avatar asked Mar 01 '15 20:03

m0fo


People also ask

How much memory should I allocate to Elasticsearch?

As a Java application, Elasticsearch requires some logical memory (heap) allocation from the system's physical memory. This should be up to half of the physical RAM, capping at 32GB.

How do I reduce Elasticsearch RAM usage?

You can avoid memory usage issues in Elasticsearch by running the Elasticsearch Health Check-Up. It will help check for many configuration errors that are related to memory usage in your cluster and offer overall improvements and suggestions to your setup.

What is the XMS and XMX values recommended for Elasticsearch?

Set Xms and Xmx to no more than 50% of your total memory. Elasticsearch requires memory for purposes other than the JVM heap.


1 Answers

You can set the memory limit for Elastic Search on Windows Server by following command:

[Elasticsearch Path]\bin>elasticsearch-service.bat manager

Note: Run command prompt as administrator

It will open manager as shown here: Image: ElasticSearch service properties

Now go to the 'Java' tab and change settings based on your requirement.

Note: Make sure, you changed it under 'JavaOptions' textbox and also for separate parameters. For example, to set 1GB initial memory pool and maximum memory pool, you can set '1024' MB for both.

You can only use this manager after you install service. For more detail, refer to the 'Using the Manager GUI' section at this link: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/windows.html#windows

After your change, you need to restart the service. And, you can also see the change reflected in the registry as well under 'elasticsearch-service-x64' node:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\elasticsearch-service-x64\Parameters\Java

Note: It is mandatory to restart the service after any changes made in manager properties window.

like image 100
Nikunj Banker Avatar answered Sep 18 '22 19:09

Nikunj Banker