Why do JVM and Node services in containers need explicit memory flags?
IntermediateProductionResource Limits, Health & Reliability
Answer
Older runtimes read host memory. Modern JVMs honor cgroup limits (-XX:MaxRAMPercentage=75), but heap is only part of the footprint (metaspace, threads, direct buffers), so 100% of the limit gets OOM-killed. Node needs --max-old-space-size below the limit; Go 1.19+ uses GOMEMLIMIT at ~90% of the limit.
More on Resource Limits, Health & Reliability
How do you set memory and CPU limits, and what happens when they are exceeded?BeginnerWhat is the difference between `--cpus`, `--cpu-shares` and `--cpuset-cpus`?BeginnerWhat does `--memory-reservation` do?AdvancedHow do you diagnose an OOM-killed container?IntermediateWhat is CPU throttling, and how do you detect it?AdvancedHow do you limit PIDs and open files in a container?Beginner