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

OrientDB's available memory estimate ignores cgroup (container) limits #7812

Closed
obi1kenobi opened this issue Oct 11, 2017 · 5 comments
Closed
Assignees
Milestone

Comments

@obi1kenobi
Copy link
Contributor

OrientDB Version: 2.2.29

Java Version: OpenJDK 8

OS: Linux

When calculating the available system memory to use as a disk cache, OrientDB currently uses the formula total system memory - JVM heap size - 2GB.

This ignores the fact that OrientDB may be running on, say, a 64GB RAM system, but inside a docker container that is only allowed to use 10GB maximum. This means that OrientDB will keep using more and more memory, thinking there's plenty of capacity, until it gets terminated by the operating system's OOM killer for exceeding its allocated limit.

As a workaround until this issue can be fixed, if you run OrientDB in a container, I recommend setting the -XX:MaxDirectMemorySize option in the ORIENTDB_OPTS_MEMORY environment variable. Keep in mind that the direct memory consumption is on top of the heap and stack memory, so leave some breathing room between the sum of these three values and the container memory limit.

Expected behavior

OrientDB should be aware of any cgroup limits that might apply to it. Other projects have had similar issues in the past, and have developed fixes. OpenBLAS and YARN are two examples.

Actual behavior

OrientDB is not aware of the cgroup limits, and keeps allocating memory until it gets killed by the OS.

Steps to reproduce

  • Get a 64GB machine / instance / VM.
  • Start an OrientDB docker container with the --memory option set to significantly less than 64GB, e.g. 6GB.
  • Put load on the database until OrientDB gets killed by the operating system for using too much RAM.
@andrii0lomakin
Copy link
Member

OK, for now, we will implement only cgroup v1 support. Later we will add cgroup 2, but in a separate issue. Taking in account that very few distr us cgroup v2 version. I think it is completely OK for now. Sad thing is that docker does not use "cgroup" namespace of course but at least /sys/fs/cgroup is provided.

andrii0lomakin added a commit that referenced this issue Nov 10, 2017
taken into account. Making Orient initialization not static.
New logger methods.
@andrii0lomakin
Copy link
Member

Fixed in 2.2.x branch will be in 3.0 soon.

@andrii0lomakin
Copy link
Member

Fixed

@obi1kenobi
Copy link
Contributor Author

Thank you, @Laa!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants