docker

kwladyka 2020-07-28T10:53:31.121700Z

CMD ["java", "-XX:InitialRAMPercentage=70", "-XX:MaxRAMPercentage=70", "-jar", "api.jar"] But docker stats show MEM USAGE much lower 113MiB / 3.848GiB. It looks like this flags are ignored while -XX:+PrintFlagsFinal show them. It is Java 14. I tried this also with Java 11. What is happening here? -Xmx1024m -Xms1024m don’t change this too. I have the newest docker on OS X.

lukasz 2020-07-28T13:55:34.123100Z

Can you try adding a runner script, rather than passing flags in the Dockerfile? - I found that sometimes it munges the args and the final command is not quite what you need YMMV of course

kwladyka 2020-07-28T14:08:38.123600Z

I tried also bash into image and run the app manually. Effect is the same.

kwladyka 2020-07-28T14:09:26.123900Z

And > -XX:+PrintFlagsFinal show them. So I see flags passed correctly.

kwladyka 2020-07-28T14:44:40.124100Z

size_t InitialHeapSize = 2894069760 {product} {ergonomic} Everything looks fine, but in practice this memory is not consumed. At least from point of view docker stats and top

kwladyka 2020-07-28T15:01:59.125400Z

wow it doesn’t also work even directly in my system

ps auwx|egrep "MEM|70964"|grep -v grep
USER               PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
kwladyka         70964   0.0  `0.5` 24216860 133284 s005  S+    4:56PM   0:05.99 /usr/bin/java -XX:+PrintFlagsFinal -XX:InitialRAMPercentage=70 -XX:MaxRAMPercentage=70 -XX:MinRAMPercentage=70 -jar api.jar
It doesn’t make sense. Does it?

kwladyka 2020-07-28T16:08:25.125800Z

How does it work then?

kwladyka 2020-07-28T16:10:49.126Z

I found Xmx / Xms also don’t work

lukasz 2020-07-28T16:14:47.126200Z

No idea, https://pl.wikipedia.org/wiki/Standardowa_odpowiedź_administratora ;-) - my only guess here would be that there's still something up with the flags, or the assumption is wrong: despite setting the min/max - the memory usage will be variable, but guaranteed to not go over the Max. Keep in mind: this is only about the heap size, JVM uses memory beyond just the heap

kwladyka 2020-07-28T16:50:33.126400Z

> JVM uses memory beyond just the heap yes, but I have too low usage, not to high what is even more strange

lukasz 2020-07-28T17:03:01.126600Z

I'm failing to see how is that a concern - best strategy for production deployments is to always over-provision, monitor usage and adjust as necessary.

kwladyka 2020-07-28T17:42:01.126800Z

yes but I have the issue about memory usage only on specific environment and so far nobody solved this