Menu

MaxRAMPercentage vs Xmx: Sizing Java Heap in Containers
📰

MaxRAMPercentage vs Xmx: Sizing Java Heap in Containers

DEV Community: java·kkkevin·3 days ago
#2m6cS3xr
#devtojava#devto#dev#heap#memory
Reading 0:00
15s threshold

Your Java service runs in a Kubernetes pod with a memory limit, and you have to decide how big the heap may grow. There are two ways to say it: a fixed -Xmx , or a percentage with -XX:MaxRAMPercentage . This guide explains how MaxRAMPercentage vs Xmx behaves inside a container, which one to pick, and how to choose the number so the pod is not OOMKilled. It is written for engineers who deploy JVM services on Kubernetes and have to defend the setting in a review.

“ Shipping container stacks – Port of Rotterdam – 2014 – 2 ” by AgainErick, CC BY-SA 4.0

What the JVM does when you set nothing

Since container support is on by default, the JVM reads the cgroup memory limit instead of the node’s RAM.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.