Skip to content

Configure a limit on direct memory usage #41954

@DaveCTurner

Description

@DaveCTurner

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions