Optimizing OrientDB Database Memory

Understanding Embedded OrientDB Database Memory

Nexus Repository Manager 3 embeds several OrientDB databases. These databases utilize what is known as direct memory.

Direct memory is not the same as the more commonly adjusted JVM max heap memory; direct memory is allocated outside of heap. The total memory used by the JVM process will equal the amount allocated for heap plus the amount allocated for direct memory.

The most important thing on tuning is assuring the memory settings are correct. What can make a difference is the right balancing between the heap and the virtual memory used by Memory Mapping, especially on large datasets (GBs, TBs and more) where the in memory cache structures count less than raw IO.

Symptoms that Direct Memory Needs Adjustment

The embedded databases have a built in profiler that actively monitors the used heap and direct memory. When the profiler detects a potential memory optimization log messages will be printed to the nexus.log similar to these:

Simple Memory Adjustments

Advanced Database Memory Adjustments

CAUTION: If the sum of maximum heap and max direct memory is set too high, these settings could cause the OS to swap with significant slow down. Ensure there is plenty of remaining RAM free on the operating system above and beyond the sum of these two values.

In general, follow this ADVANCED procedure if you detect any nexus.log messages similar to the above:

Adjust the maximum direct memory size. Find the log message mentioning the highest recommended DISKCACHE to value. In the example log messages above this would be 3036MB

Set the JVM option -XX:MaxDirectMemorySize equal to the size recommended by the found log message in step 1.A. Edit <app-dir>/bin/nexus.vmoptionsB. Replace the existing line of the format -XX:MaxDirectMemorySize=size[g|G|m|M|k|K]C. Using the example value above, the new line would look like

-XX:MaxDirectMemorySize=3036M

Adjust the JVM heap size. Find the log message mentioning the highest recommended maxHeap to value. In the example log messages above this would be 2652M

Set the JVM options -Xms and -Xmx equal to the value recommended by the found log message in step 3.A. Edit <app-dir>/bin/nexus.vmoptionsB. Replace the existing lines of the format -Xmssize[g|G|m|M|k|K] and -Xmxsize[g|G|m|M|k|K]C. Using the example value above, the new line would look like