Dimensioning a docker container for a JVM based service is tricky (as we all know). I'm pretty sure we have slightly under-dimensioned a container and want to clear up a few questions I have relating to specific jcmd (Native Memory Tracker) outputs that we see when monitoring.
Questions:
- Are Direct Byte Buffers included in "Internal" as reported by jcmd?
- What else apart from code cache is in "Code" as reported by jcmd?
- Is there a good way to limit the "Code" section as reported by jcmd. I read https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm but this only covers the code cache limits and it is suggested to leave the JVM default as is.
JCMD output is here.
Direct Byte Buffers JMX properties are here.
Some background details:
The Setup:
- Spring boot based application
JVM Options:
-server -Xms1792m -Xmx1792m -XX:MetaspaceSize=128M - XX:MaxMetaspaceSize=192M -XX:+UseG1GC -XX:+UseStringDeduplication - XX:MaxDirectMemorySize=256m -XX:NativeMemoryTracking=detail
- Docker container 2500MiB running in AWS/EC2