In order to ensure cost efficiency, all platform-managed Java servers are automatically configured to utilize memory in the most beneficial way. It is achieved by adjusting the main Java memory parameters based on resources allocated to a container.
Tip: Custom Java servers (e.g. inside Docker containers or VPS) can be optimized similarly using the Java Memory Agent add-on.
The default options can be manually changed to ensure high performance or to support any custom implementation.
In order to provide all the preferred Java options at once, the variables.conf file can be utilized.
Depending on a particular application server you are working with, the exact location may vary:
If needed, you can redefine the main memory options via container variables.
That’s it! Now, your application is running with your custom Java options.
Most of the essential memory parameters (-Xms, -Xmn, -Xmx, -Xminf, -Xmaxf, -XX:MaxPermSize, *-XX:+Use.GC) can be redefined using the dedicated environment variables.
As an example, you can Add the -Xmx option (i.e. maximum size for the Java heap memory):
Tip: The platform supports two additional variables that allow setting up main RAM parameters as a percentage of the total memory available:
XMS_DEF_PERCENT - the initial size (%) of the memory allocation pool XMX_DEF_PERCENT - the maximum size (%) of the memory allocation pool These values are automatically validated - if XMS is bigger than XMX, its actual value is set equal to XMX.
When operating with the Spring Boot and Java Engine templates, you can provide two additional variables:
Don’t forget to restart your application server(s) in order to apply changes.