Thanks, I spent a couple days more and got a better understanding. Sorry about confusing the OS with the JVM memory settings.
I was able to get a much happier container by using the newest, newest openjdk image: redhat-openjdk-18/openjdk18-openshift This image uses the -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap options and so is much more container aware. I was able to get the application to run in less memory as a swarm application and it looks pretty good. -----Original Message----- From: Aleksandar Kostadinov <akost...@redhat.com> Sent: Thursday, June 14, 2018 2:48 AM To: Karl Nicholas <karl.nicho...@outlook.com>; users@lists.openshift.redhat.com Subject: Re: JAVA_MAX_MEM_RATIO greater than 60% Can you run the app with enough memory and check process memory usage from `oc rsh`? Perhaps it will give more insight. The container is not running a separate OS. It is just the process you are starting within that container and the libraries it loads. And any additional processes it spawns. So standard memory profiling techniques should apply within the container. I know that people are looking at ways to decrease java footprint for small apps. You know the java modularization effort. graalvm as another example. Presently situation is not ideal for such use cases IMO. I trust that things will improve over time though. Karl Nicholas wrote on 06/13/18 00:19: > I’m messing around with*JAVA_MAX_MEM_RATIO* to see about saving on > memory. With every setting I also adjust the container memory so that > I get the following JVM parameters. > > exec java > -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/etc/jolokia.pr > operties -Xms512m -Xmx512m -XX:+UseParallelGC -XX:MinHeapFreeRatio=20 > -XX:MaxHeapFreeRatio=40 -XX:GCTimeRatio=4 > -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=256m > -XX:ParallelGCThreads=2 > -Djava.util.concurrent.ForkJoinPool.common.parallelism=2 > -XX:CICompilerCount=2 -XX:+ExitOnOutOfMemoryError -cp . -jar > /deployments/opinions-web-swarm.jar > > The “*Xms512m -Xmx512m*” are, to me, the important ones. So, if I set > the *container memory to 1Gb and the JAVA_MAX_MEM_RATIO to 50% *(the > default), then I get the above JVM settings and my application works fine. > > If I set the *container memory to 854Mb and the JAVA_MAX_MEM_RATIO to > 60%*, then I get the above settings and my application, so far, works fine. > > If I set the *container memory to 732Mb and the JAVA_MAX_MEM_RATIO to > 70%*, then I get the above JVM settings and my application *CRASHES.* > > So, something outside the JVM needs more 732-512 or 220Mb (and less > than 342, I’m guessing 256?) of memory to run the JVM? Does the OS > inside need that much? The image is a wildfly-11-swarm image with > EJB/JSF/REST and a few things built inside of openjdk18-openshift:latest > image. > > Is there some way to configure or know how much the > openjdk18-openshift redhat supplied image needs for memory outside of the JVM > settings? > Should I look into rebuilding it myself if I need to control the > memory usage? > > Thanks. > > > > _______________________________________________ > users mailing list > users@lists.openshift.redhat.com > https://nam03.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists > .openshift.redhat.com%2Fopenshiftmm%2Flistinfo%2Fusers&data=02%7C01%7C > %7C18b48de1cf84463bcca208d5d1dbf066%7C84df9e7fe9f640afb435aaaaaaaaaaaa > %7C1%7C0%7C636645664914149975&sdata=LmWXZvdIPKwrftJYXKfKXGczId%2BUqRh% > 2BTy596gZnudc%3D&reserved=0 > _______________________________________________ users mailing list users@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/users