TLDR;
Why bother settings -Xmx and -Xms in a kubernetes app?
We've inherited a kubernetes app that is having out of memory errors. It looks like the initial devs set kubernetes resource limits (.95 CPU core and 4Gb memory) as shown below. However, they also set the max heap size in JAVA_OPTS -Xmx to 800mb.
I've found lots of good material on best settings for -Xmx (eg this one), but can't find a straight answer to the following question: do we really need to set -Xmx (and less importantly, -Xms) in a kubernetes container? We've already set hard limits on the container
resources, so what is the point to setting these flags? If we removed them altogether, what would the consequence be? Would the app GC more often? Would it scale heap size dynamically or would heap size max be fixed at some default maxium like 256MB? Is there any rule of thumb of setting -Xmx in proportion to kubernets containers?
