nexus3 jvm memory change

3,804 views
Skip to first unread message

Morten Bjoernsvik

unread,
Jul 13, 2018, 6:26:36 PM7/13/18
to Nexus Users
Hi

Nexus OSS 3.12.1-01 systemd service


com.orientechnologies.orient.core.exception.OJVMErrorException: JVM error 'OutOfMemoryError : Java heap space' occurred during data processing, storage is switched to 'read-only' mode.
To prevent this exception please restart the JVM and check data consistency by calling of 'check database' command from database console.

I tried adding in the nexus startup script:
# Uncomment the following line to add additional VM parameters
INSTALL4J_ADD_VM_PARAMS="-Xms1600M -Xmx1600M -XX:MaxDirectMemorySize=2G"

But this results in it showing twice and the last option overwrites the first:
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -server -Dinstall4j.jvmDir=/usr/lib/jvm/java-8-openjdk-amd64/jre -Dexe4j.moduleName=/home/nexus/nexus-current/bin/nexus .... -Xms1200M -Xmx1600M -XX:MaxDirectMemorySize=2G -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G ....

How should this be configured ?

can I put it in nexus.properties or nexus.service so it survives an upload?

Thanks

--
MortenB


Rich Seddon

unread,
Jul 13, 2018, 7:03:14 PM7/13/18
to Nexus Users
The memory settings can be found in $INSTALL_DIR/bin/nexus.vmoptions.

Follow our guidelines here for configuring them:

Morten Bjoernsvik

unread,
Jul 14, 2018, 4:24:05 AM7/14/18
to Nexus Users
Thanks, worked like a dream, but the culprit is orientDB

I only have 6GB on this vm and it is way too little, event with no diskcache:

/home/nexus/nexus-current # java -Xmx6G -Dstorage.diskCache.bufferSize=0 -jar lib/support/nexus-orient-console.jar
> connect PLOCAL:/home/nexus/sonatype-work/nexus3/db/component admin admin
> check database
> status

I think my solution is to just to delete the blob and start over. (or get IT to add more mem)
This is a usecase for having a nexus cluster:
Before nexus we maintained many docker v2 registries, instead of deletion we just created a new pushed the one we liked to save and deleted the old.

Thanks


Stuart McCulloch

unread,
Jul 14, 2018, 7:54:05 PM7/14/18
to Morten Bjoernsvik, Nexus Users
The database uses direct (native) memory much more than Java heap - so if you set the Java heap maximum to the size of the physical memory then you'll negatively impact the database and cause a lot of swapping in the OS. That's why the suggested settings assign about half of the physical memory to the direct/native heap and just over a quarter to the Java heap.

So it's better to gradually increase the Java heap maximum, rather than bump it too high and leave nothing for the database. Also note that setting "storage.diskCache.bufferSize" to zero won't affect usage of the Java heap, since the disk cache is located in direct memory - it will also lead to a lot of warning messages about degraded performance.

Did the OutOfMemoryError correspond to a particular operation in the logs, or after the system has been up for a while, or is it more immediate? Did the stack indicate what triggered it? (Orient has various hooks that detect unusual/unexpected errors which switch the database to read-only mode as a precaution, but it doesn't necessarily mean the exception originated inside the database.)

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/70349597-d798-4ea3-999f-67997f3b8038%40glists.sonatype.com.

Morten Bjoernsvik

unread,
Jul 15, 2018, 10:07:31 AM7/15/18
to Nexus Users, morten.b...@gmail.com
Thanks for the tip:

This was only for the orientdb console not for nexus.
I never managed to get it to finish whatever I set the xms, xmx or diskcache to, but having larger xmx made it last longer (might be because it ran slower)

In the end I renamed sonatype-work and got a clean new nexus. recreating the repos and pushin the images back.
old jobs push and pull using the same tokens as long as users are recreated with same name.
Some other users have to recreate their acconts and push, but we can live with it.

For the future I'll look into more orientdb atleast learning the dump annd restore so I have a in replacement backup.

Thanks
--
MortenB
Reply all
Reply to author
Forward
0 new messages