Azure Functions: JAVA_OPTS -XMX not working

Viewed 304

i am implementing an azure-functions with java and are trying to set the maximum memory according to https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java?#customize-jvm . I think i did everything right, but the memory limit is getting ignored by the function.

i set the JAVA_OPTS in the pom:

<build>
  <plugins>
    <plugin>
      <groupId>com.microsoft.azure</groupId>
      <artifactId>azure-functions-maven-plugin</artifactId>
      <configuration>
        <appSettings>
          <property>
            <name>JAVA_OPTS</name>
            <value>-Xmx120m</value>
          </property>
          <property>
            <name>WEBSITE_USE_PLACEHOLDER</name>
            <value>0</value>
          </property>
        </appSettings>
        <runtime>
          <os>linux</os>
          <javaVersion>11</javaVersion>
        </runtime>
      </configuration>
    </plugin>
  </plugins>
<build>

The azure-function runs with a Consumption plan, so WEBSITE_USE_PLACEHOLDER is also set. The JAVA_OPTS is correctly displayed in Azure portal and later in the application (System.getenv("JAVA_OPTS")) with the right value.

Am i doing something wrong or is this a bug?

ps. JAVA_OPTS is used by the java-worker: https://github.com/Azure/azure-functions-java-worker/blob/master/worker.config.json#L7

0 Answers
Related