关于K8S中JVM性能的一些分析
【代码】关于K8S中JVM性能的一些分析。
Determining Pod Quality Of Service
A Pod’s Quality of Service (QoS) is based on whether it’s configured with resource requests and limits:
-
Best Effort QoS (lowest priority): If you don’t configure requests and limits for a Pod, then the Pod is given a
best-effort
QoS. In cases where a Node runs out of non-shareable resources, the default out-of-resource eviction policy evicts running Pods with thebest-effort
QoS first. -
Burstable QoS (medium priority): If you configure both resource requests and limits for a Pod, and set the requests to be less than their respective limits, then the Pod will be given a
burstable
QoS. Similarly, if you only configure resource requests (without limits) for a Pod, then the Pod QoS is alsoburstable
. If a Node runs out of non-shareable resources, the Node’skubelet
will evictburstable
Pods only when there are no more runningbest-effort
Pods. -
Guaranteed QoS (highest priority): If you set a Pod’s requests and the limits to equal values, then the Pod will have a
guaranteed
QoS. These settings indicate that your Pod will consume a fixed amount of memory and CPU. With this configuration, if a Node runs out of shareable resources, then the Node’skubelet
will evictbest-effort
andburstable
QoS Pods before terminatingguaranteed
QoS Pods.
Oracle的推荐配置:
For most use cases, Oracle recommends configuring WebLogic Pods with memory and CPU requests and limits, and furthermore, setting requests equal to their respective limits to ensure a guaranteed
QoS.
1)Java heap size and memory resource considerations
Oracle recommends configuring Java heap sizes for WebLogic JVMs instead of relying on the defaults. For detailed information about memory settings when running WLST from the pod where the WLS server is running, see Use kubectl exec.
2)Default heap sizes
With the latest Java versions, Java 8 update 191 and later, or Java 11, if you don’t configure a heap size (no -Xms
or -Xmx
), the default heap size is dynamically determined:
-
If you configure the memory limit for a container, then the JVM default maximum heap size will be 25% (1/4th) of container memory limit and the default minimum heap size will be 1.56% (1/64th) of the limit value.
In this case, the default JVM heap settings are often too conservative because the WebLogic JVM is the only major process running in the container.
-
If no memory limit is configured, then the JVM default maximum heap size will be 25% (1/4th) of its Node’s machine RAM and the default minimum heap size will be 1.56% (1/64th) of the RAM.
In this case, the default JVM heap settings can have undesirable behavior, including using unnecessary amounts of memory to the point where it might affect other Pods that run on the same Node.
3) Configuring heap size
If you specify Pod memory limits, Oracle recommends configuring WebLogic Server heap sizes as a percentage. The JVM will interpret the percentage as a fraction of the limit. This is done using the JVM -XX:InitialRAMPercentage
and -XX:MaxRAMPercentage
options in the USER_MEM_ARGS
Domain environment variable. For example:
更多推荐
所有评论(0)