Home > Blockchain >  Setting initial & max JVM memory in an Azure Function (App Service)?
Setting initial & max JVM memory in an Azure Function (App Service)?

Time:06-09

In the following context

  • Azure Function under App Service Plan
  • P2V3 instance
  • Java 11 worker

Does it make sense to set JAVA_OPTS to -Xms14848m -Xmx14848m, as described on Configure a Java app for Azure App Service?

By default, FUNCTIONS_WORKER_PROCESS_COUNT is set to 1. If this setting is left unchanged, then there should be only one worker per instance. Thus it should be safe to set the initial memory like that. Are there any problems with this reasoning?

CodePudding user response:

Does it make sense to set JAVA_OPTS to -Xms14848m -Xmx14848m

Yes, it is used to allocate the memory while the iteration starts. To set the allocated memory or JVM Runtime options, it will pass the JAVA_OPTS with the Options and values to the app service.

When App Service starts, it passes this setting (JAVA_OPTS)to the Java runtime as an environment variable.

By default, FUNCTIONS_WORKER_PROCESS_COUNT is set to 1. If this setting is left unchanged, then there should be only one worker per instance. Thus it should be safe to set the initial memory like that. Are there any problems with this reasoning?

Yes, It is safe. Even the FUNCTIONS_WORKER_PROCESS_COUNT is set to 1 the memory allocation of JAVA_OPTS can be passed to the Function Worker run time. When the iteration starts it will take the environment variable of JAVA_OPTS and its value and process with their memory allocation. Refer here for more information.

  • Related