Skip to main content

Memory Management

Configuring the JVM is an important step of a project. Here we discuss the mandatory and preferred JVM options to get the best performance out of Atoti Server.

Memory Allocation

Configuring how much memory is allocated to your application is usually necessary. You can control it through these options:

-Xmx<max on-heap memory>
-Xms<min on-heap memory>
-XX:MaxDirectMemorySize=<max off-heap memory>

If you are running Atoti on several NUMA nodes but have not configured its NUMA properties, using the JVM NUMA option will result in better performance:

-XX:+UseNUMA

Garbage Collection

A poorly-configured garbage collector can make a significant dent in your application's performance and uptime. We recommend using these options:

-XX:+ExplicitGCInvokesConcurrent
-XX:MetaspaceSize=500m

We recommend keeping the default G1GC garbage collection algorithm since it is the only one that has been battle-tested in production with Atoti Server.

Logging GC info may help fine-tune performance. You can enable logging with the following option:

-Xlog:gc*=info,safepoint*=warning:file=<path to log file>/gc-$(date +%Y_%m_%d-%H_%M).log

Fine-tuning

Here we provide important options that are known to affect the performance of Atoti Server with the G1GC. Only try them if you experience issues with Garbage Collection, and have found out after analyzing the logs that they indeed can help with the issues you are having. The values to set up need to be tuned for your application:

  • -XX:G1NewSizePercent=xx -XX:G1MaxNewSizePercent=xx enables to change the percentage of the heap to use for the young generation. You may want to increase this percentage when using very large machines with terabytes of RAM, since a heavy use of off-heap enables the old generation not to host a lot of data.
  • -XX:InitiatingHeapOccupancyPercent=x enables to change the heap occupancy threshold that triggers concurrent garbage collection cycles. You may want to decrease this value in order not to wait up until the last minute on very large machines.

More information related to the G1GC fine-tuning is available on Oracle's official guide.