Nexus Repository Memory Overview
Nexus Repository Memory Overview
The sections below explain the different configurable memory types, Java arguments for managing certain memory configurations, and examples of using those Java arguments.
Configurable Memory Types
The following describes the configurable memory types for Sonatype Nexus Repository deployments; visit the Configuring the Runtime Environment page to learn how to change the default memory settings.
Java Virtual Machine (JVM) Heap Memory
Stores the objects created by the Java application. The JVM manages this space, and a special process called garbage collection automatically cleans up unused objects to free up memory.
- You must specify a min (-Xms) and max (-Xmx); these values should be identical
- Do not increase the heap memory larger than recommendations or set the min and max to be different; this will cause performance issues
- Min allowable is 2703M
- If you go beyond 8G, ensure there is enough RAM to handle and that G1GC garbage collection is enabled
Host or OS Physical Memory (RAM)
Total memory that is allocated to the operating system or virtual hardware as related to the node.
- Min allowable is 8G; no max limit
- Minimum unallocated host physical memory should be no less than 1/3 of total physical RAM to allow for virtual memory swap
- max heap + max direct memory <= host physical/RAM * 2/3
JVM Direct Memory
Reserved section of the operating system's physical memory that Java programs access directly, bypassing and completely independent of heap memory. This is allocated outside of and distinctly from heap memory and is managed by application code that needs to process large amounts of data at once.
Memory-Related Java Arguments
The table below explains Java arguments that you can use for memory configurations. Examples are provided in the example maximum memory configurations section.
| Java Argument | Purpose | Advice |
|---|---|---|
| -Xmx | Set Maximum Heap Memory | - PostgreSQL / H2 - Set at 50% of host RAM - Legacy OrientDB - Set at two-thirds host RAM minus Max Direct Memory |
| -Xms | Set Minimum Heap Memory | - Set identical to Max Heap |
| -XX:+UseG1GC | (Legacy Java 8 Only) Use G1 Garbage Collection Algorithms | - Used for legacy Java 8 only - Set if heap is greater than or equal to 8GB |
| -XX:MaxDirectMemorySize | Set Java Direct Memory | - PostgreSQL / H2 - Set at 25% of host RAM - Legacy OrientDB - Set at two-thirds of host RAM minus Max Heap |
Example Maximum Memory Configurations
The table provides examples of memory configuration using the Java arguments.
See the memory-related Java arguments section to learn more.
| RAM Memory | PostgreSQL | H2 | OrientDB |
|---|---|---|---|
| 8GB | -Xms4G -Xmx4G-XX:MaxDirectMemorySize=2g |
-Xms4G -Xmx4G-XX:MaxDirectMemorySize=2g |
-Xms2703M -Xmx2703M-XX:MaxDirectMemorySize=2703M |
| 16GB | -Xms8G -Xmx8G-XX:MaxDirectMemorySize=4g |
-Xms8G -Xmx8G-XX:MaxDirectMemorySize=4g |
-Xms4G -Xmx4G-XX:MaxDirectMemorySize=6717M |
| 32GB | -Xms16G -Xmx16G-XX:MaxDirectMemorySize=8g |
requires PostgreSQL* | requires PostgreSQL* |
| 64GB | -Xms30G -Xmx30G *-XX:MaxDirectMemorySize=16g |
requires PostgreSQL* | requires PostgreSQL* |
* Deployments recommended to use PostgreSQL
* At 32g, Compressed Ordinary Object Pointers (OOPS) is disabled, which makes the JVM use more memory