I am using below parameters to override my heap config for JVM -
JBP_CONFIG_OPEN_JDK_JRE: '[memory_calculator: {memory_heuristics: {heap: 65, metaspace: 20}}]'
But I am not able to see the changes getting reflected. Can someone help?
The options you're using only apply for version 3.x of the Java buildpack.
Starting with Java buildpack 4, all you need to do is to set JAVA_OPTS
with your JVM configuration options. So if you want to override the max heap size and change the thread stack size, you can do cf set-env my-app JAVA_OPTS '-Xmx100m -Xss228k'
.
The Java buildpack will read these values and attempt to adjust the other areas of memory used by the JVM so that it can accommodate running your app within the defined memory limit. If it cannot do that, the Java buildpack will print an error telling you this.
For example, if you set the memory limit to 512M and you set a max heap of 500M, that's not going to work. There won't be enough memory left for other areas of the JVM and the JBP will reject your settings. This is a safety check so to keep your application from exceeding the memory limit and crashing at some point in the future.