Interview Prep/Docker/Resource Limits, Health & Reliability

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.

All Docker questions Roadmap: Docker & containers

More on Resource Limits, Health & Reliability