Pandiyan Cool
Pandiyan Cool

Reputation: 6565

Setting ES_HEAP_SIZE in windows

I'm using Windows 2012 R2 machine.

I have set my Heap Size in Environment variable as follows ES_HEAP_SIZE 4g

After setting the heap size, i have installed Elasticsearch as windows service using command

service.bat install

When i started the service, Elasticsearch services has taken 4GB properly (Checked in Taskmanger.exe)

After some time, the memory used by elasticsearch service is came down to 1 GB.

Is this expected?

Upvotes: 2

Views: 2852

Answers (2)

dr_
dr_

Reputation: 2292

This is apparently an issue of ES under Windows.

Quoting from the link:

The 4gb committed heap size that you see in the node stats API is the amount of virtual memory that's reserved by setting ES_HEAP_SIZE (Xms), which is expected, even with bootstrap.mlockall disabled.

By enabling bootstrap.mlockall, we expect the call to VirtualLock() to lock the working set into physical memory, which happens initially (this is the memory you see in task manager), but eventually drops off.

I don't have a solid explanation for this yet, but I have observed that the more memory pressure the system is under (i.e. less free space available), the quicker the "drop off" occurs. It's as though Windows doesn't respect the fact that the pages in the working set are locked, and will release them when resources become low.

There's a lot of info out there that seems to indicate that VirtualLock doesn't guarantee pages won't be swapped, only reduces the odds, however the documentation says nothing about this.

Upvotes: 2

chester89
chester89

Reputation: 8627

1Gb is default heap size for Elasticsearch. So when you set the env.variable, you set maximum amount of memory it's allowed to use. If you don't issue any queries, the memory usage may drop to the default

Upvotes: 0

Related Questions