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] >
