Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k
stars
721
forks
source link
Define standard ENV vars passing Kubernetes "request" limits to the JVM #9239
K8 provides two resource bounds for controlling the use of memory and cpu in a container:
Requests: guaranteed minimum a container will get
Limits: upper bound that a container can't go beyond without restriction
Currently, the "limit" is used to create the cgroup for the container. This means the JVM's default container awareness is based on the upper bound (limit) rather than the lower bound (request).
To my knowledge, the "request" limits are not exposed to the container by default so the JVM can't use them to control heap and CPU settings.
We should define a standard set of environment variables for the REQUEST parameters to allow the JVM to size itself based on the lower bound rather than the upper. These ENV vars would be used in preference to cgroup settings.
We would also need to work with groups like Appsody and others that are creating yaml files to set the env vars in their yaml.
K8 provides two resource bounds for controlling the use of memory and cpu in a container:
Currently, the "limit" is used to create the cgroup for the container. This means the JVM's default container awareness is based on the upper bound (limit) rather than the lower bound (request).
To my knowledge, the "request" limits are not exposed to the container by default so the JVM can't use them to control heap and CPU settings.
There is a K8 api, the Downward API, that allows passing K8-related info into the container. See https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
We should define a standard set of environment variables for the REQUEST parameters to allow the JVM to size itself based on the lower bound rather than the upper. These ENV vars would be used in preference to cgroup settings.
We would also need to work with groups like Appsody and others that are creating yaml files to set the env vars in their yaml.
Example ymal from https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/ :