Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure a limit on direct memory usage #41954

Closed
DaveCTurner opened this issue May 8, 2019 · 2 comments · Fixed by #42006
Closed

Configure a limit on direct memory usage #41954

DaveCTurner opened this issue May 8, 2019 · 2 comments · Fixed by #42006
Assignees
Labels
:Core/Infra/Core Core issues without another label >enhancement resiliency

Comments

@DaveCTurner
Copy link
Contributor

Sometimes a node can use substantially more memory than configured by the -Xmx setting. This setting limits the size of the JVM heap, but there are other memory consumers that are not controlled by this setting. The documentation says the following:

set Xmx to no more than 50% of your physical RAM, to ensure that there is enough physical RAM left for kernel file system caches

This recommendation can result in running out of physical RAM, because we might allocate another 50% of the RAM as direct buffers, plus JVM overheads, OS overheads, etc. The consequence on Linux is often that Elasticsearch is killed by the OOM killer.

Direct memory is a major consumer of off-heap memory. The maximum amount of direct memory can be controlled with the -XX:MaxDirectMemorySize setting. At the moment this setting is unset by default. We discussed this today and decided against asking users to configure this setting, because it is easy to misconfigure and misconfiguration can lead to bad situations such as heavy GCs and OOMs.

We decided to automatically set -XX:MaxDirectMemorySize to half of the -Xmx setting, unless explicitly set by the user, in which case we would respect that setting.

@DaveCTurner DaveCTurner added >enhancement resiliency :Core/Infra/Core Core issues without another label labels May 8, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jasontedor jasontedor self-assigned this May 8, 2019
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this issue May 10, 2019
This commit slightly reworks the recommendations in the docs about setting the
heap size:

* the "rules of thumb" are actually instructions that should be followed

* the reason for setting `Xmx` to 50% of the heap size is more subtle than just
  leaving space for the filesystem cache

* it is normal to see Elasticsearch using more memory than `Xmx`

* replace `cutoff` and `limit` with `threshold` since all three terms are used
  interchangeably

* since we recommend setting `Xmx` equal to `Xms`, avoid talking about setting
  `Xmx` in isolation

Relates elastic#41954
DaveCTurner added a commit that referenced this issue May 10, 2019
This commit slightly reworks the recommendations in the docs about setting the
heap size:

* the "rules of thumb" are actually instructions that should be followed

* the reason for setting `Xmx` to 50% of the heap size is more subtle than just
  leaving space for the filesystem cache

* it is normal to see Elasticsearch using more memory than `Xmx`

* replace `cutoff` and `limit` with `threshold` since all three terms are used
  interchangeably

* since we recommend setting `Xmx` equal to `Xms`, avoid talking about setting
  `Xmx` in isolation

Relates #41954
DaveCTurner added a commit that referenced this issue May 10, 2019
This commit slightly reworks the recommendations in the docs about setting the
heap size:

* the "rules of thumb" are actually instructions that should be followed

* the reason for setting `Xmx` to 50% of the heap size is more subtle than just
  leaving space for the filesystem cache

* it is normal to see Elasticsearch using more memory than `Xmx`

* replace `cutoff` and `limit` with `threshold` since all three terms are used
  interchangeably

* since we recommend setting `Xmx` equal to `Xms`, avoid talking about setting
  `Xmx` in isolation

Relates #41954
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this issue May 27, 2019
This commit slightly reworks the recommendations in the docs about setting the
heap size:

* the "rules of thumb" are actually instructions that should be followed

* the reason for setting `Xmx` to 50% of the heap size is more subtle than just
  leaving space for the filesystem cache

* it is normal to see Elasticsearch using more memory than `Xmx`

* replace `cutoff` and `limit` with `threshold` since all three terms are used
  interchangeably

* since we recommend setting `Xmx` equal to `Xms`, avoid talking about setting
  `Xmx` in isolation

Relates elastic#41954
@Helmut-Onna
Copy link

@ferrangasulla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement resiliency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants