- JVM ergonomics
- Libraries ergonomics
JVM and libraries decide how much memory and how many threads to use. This decision is based on a host hardware configuration. JVM and some libraries are designed to take a full advantage of all available resources.
- Docker uses Linux namespaces and cgroups
- In a docker instance, an application can access a host hardware configuration
- Java doesn't know about Docker, cgroups and namespaces (before April 2017)
- What if memory limit is less than JVM wants to allocate for heap
- What if memory limit is a little bit more than JVM wants to allocate for heap
JVM allocates memory for
- Heap
- Metaspace
- Code
- GC
- Threads
- Native objects
All dockerised JVMs think they exclusevely have all cores.
- CPU limits work out of the box
- for a memory, JVM option is still required