> The problem I want to point out is that by default the heap size is 64MB.
Default heap size is a function of available memory [1], [2] which now also respect the cgroup settings. However a user may want to specify such options in some cases. So would be good to have support for that > Now the problem is that I am not aware of any way the runtime can read the > annotations at init time... Its not possible currently as this information is not passed [3]. However it should be possible to extract and pass it by tweaking the flow at [4] Chetan Mehrotra [1] https://stackoverflow.com/questions/4667483/how-is-the-default-java-heap-size-determined [2] https://medium.com/adorsys/jvm-memory-settings-in-a-container-environment-64b0840e1d9e [3] https://github.com/apache/incubator-openwhisk/blob/master/docs/actions-new.md#initialization [4] https://github.com/apache/incubator-openwhisk/blob/fb0bab64de6634725b409a63ffbb90fee295e8c1/common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala#L278 On Mon, May 6, 2019 at 6:27 PM Michele Sciabarra <[email protected]> wrote: > > The problem I want to point out is that by default the heap size is 64MB. > > I know a lot of applications that does not work with the default amount and > you have to increase it. > Indeed I had the experience of trying to run some applications in Java in the > IBM cloud and I got out of memory. > Another common problem is the requirement to set also -Xss for certain > libraries (for example , sbt ). > > This is the reason because I am proposing to add the ability to specify the > heap size and other parameters. But to avoid to break the existing, I would > leave the default. Only if you explicitly provide an annotation then the > different parameters will be used. > > Now the problem is that I am not aware of any way the runtime can read the > annotations at init time... > > -- > Michele Sciabarra > [email protected] > > ----- Original message ----- > From: Sven Lange-Last <[email protected]> > To: [email protected] > Subject: Re: Setting "parameters" at init time > Date: Monday, May 06, 2019 12:50 PM > > Hello Michele, > > with "-Xmx", you set the maximum heap size of a JVM. This is part of > virtual memory settings. In contrast, the action memory limit is a > physical memory limit. It's possible that an action process occupies much > more virtual memory than physical memory. For a JVM, it's not uncommon > that it consumes 1 GiB virtual memory - while only consuming 256 MiB > physical memory that is accounted to the process. > > With setting the maximum heap size of a JVM to the action's physical > memory limit, you have a high chance of breaking a lot of actions. > > Please see the discussion in [1] for more technical details. > > I'm afraid that there is no easy calculation that we could use to > determine the needed maximum heap size of a JVM from the action's physical > memory limit. > > > [1] https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/104 > > > > Mit freundlichen Grüßen / Regards, > > Sven Lange-Last > Senior Software Engineer > IBM Cloud Functions > Apache OpenWhisk > > > E-mail: [email protected] > Find me on: > > > Schoenaicher Str. 220 > Boeblingen, 71032 > Germany > > > > > IBM Deutschland Research & Development GmbH > Vorsitzende des Aufsichtsrats: Martina Koederitz > Geschäftsführung: Dirk Wittkopp > Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, > HRB 243294 > > > "Michele Sciabarra" <[email protected]> wrote on 2019/05/06 11:55:37: > > > From: "Michele Sciabarra" <[email protected]> > > To: [email protected] > > Date: 2019/05/06 11:55 > > Subject: Setting "parameters" at init time > > > > I am working on the new runtime for java, and I am facing a "new" > > challenge: java runtime command line parameters. > > > > In Java world it is extremely common you set the memory size > > allocated by java with -Xmx. > > > > In the current runtime I see that java is started with the default > > parameters only. > > > > CMD ["java", "-Dfile.encoding=UTF-8", "-jar", "/javaAction/build/ > > libs/javaAction-all.jar"] > > > > Also there are a lot of parameters that are interesting to set. > > Unfortunately the default parameters are inadequate in many cases. > > > > In the command line it is possible to set the maximum memory of the > > action but I guess those informations are only used by the Docker > > container. So I ask: > > > > - is it possible to read the amount of memory allocated to the > > action so I can do -Xmx<memory>? > > - it is possible to read the annotations so I can pass those > > informations to be able to tune VM behaviour? > > > > If the answer is "it is not possible", then what about adding them > > as extra informations at init time (I can volunteer to work on that...) > > > > -- > > Michele Sciabarra > > [email protected] > >
