Adjusting memory allocated to Nexus

Symptoms Nexus Needs More Memory

Any time you notice the symptoms below, or you have any other reason to suspect Nexus has run out of memory, Nexus will be in an undefined state until it is restarted.

If you suspect a memory leak, first review recent release notes to be sure you are not running into a known bug.


The text "OutOfMemory" in your nexus log files is the most obvious sign Nexus has run out of memory.

Although rare, Jetty can almost imperceptibly trigger an OutOfMemoryException. In some versions of Nexus, we have added logging to try to capture this. The following message in your log files would indicate Nexus does not have enough memory.

Jetty pooled thread death detected! System might be running low on memory!

Monitoring

Short term monitoring of the JVM heap with a tool like VisualVM is a good method to determine if Nexus memory management is performing adequately. Nexus also comes with some built in REST resources that can be used to understand the current state of the JVM.

Longer term and for mission critical installations, we strongly suggest an Enterprise monitoring tool such as New Relic or DripStat.

Increasing Nexus Allocated Memory

Nexus is launched by a wrapper. The wrapper config file is located at <nexus_install_dir>/bin/jsw/conf/wrapper.conf. Allocated memory is adjusted by editing this file and restarting Nexus.

# Size Java memory, in MB (-Xms)
wrapper.java.initmemory=256
# Size Java memory, in MB (-Xmx). This option only supports a setting up to 4096 (4Gb).
# If you need more, comment this option out and use an explicit wrapper.java.additional option with -Xmx
wrapper.java.maxmemory=768

Any other JVM arguments are specified using the `wrapper.java.additional` properties in this file. For example, adjusting the permanent generation size:

wrapper.java.additional.1=-XX:MaxPermSize=192m

See the wrapper configuration documents for more information on the wrapper.java.additional property format.

Increasing Memory More than 4GB

If wrapper.java.maxmemory or wrapper.java.initmemory is set to a value higher than 4096, 4096MB will still be used.

To workaround this limit, please follow the special instructions for increasing heap memory more than 4GB.

Note that it is almost never necessary to allocate more than 4Gb.  Whatever you do make sure there is enough physical RAM to support the maximum heap size, size of the Nexus code base + other overhead, and any additional applications running on your server.  If the server starts to swap performance will go downhill rapidly.

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk