3

im running Nexus 3 on a 4 CPU Docker Host only limiting RAM Usage to the Container.

After Upgrading to sonatype/nexus3:3.17.0 from 3.16.1 Nexus tells me on the Status Page in the Admin Backend:

Available CPUs: The host system is allocating a maximum of 1 cores to the application. A minimum of 4 is recommended.

I don't know why this is even showing

So i entered the nexus container and retrieved some info how many cores are in there

cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l

Result: 4

Does anybody know whats wrong here ?

Robert Lachner
  • 657
  • 1
  • 8
  • 22
  • 1
    See answer in https://stackoverflow.com/questions/36453298/java-runtime-getruntime-availableprocessors-and-nproc-return-different-value – Dario Louzado Aug 22 '19 at 17:47

1 Answers1

11

finally i found out what's wrong here.

Java and its crappy docker implementation.

So if you want that your JavaVM fully recognizes all host cpus yout have to set proper JAVA_OPTS.

For Nexus this means:

INSTALL4J_ADD_VM_PARAMS=-XX:ActiveProcessorCount=<NUMBER_OF_CORES>

Et voila - the Nexus Status Page got the right amount of CPU Cores.

Robert Lachner
  • 657
  • 1
  • 8
  • 22
  • 2
    What "Java Docker implementation" is supposed to mean? Java here is an a program to run a JVM and support the execution of Java binaries, without that option, Java takes the max no. of CPUs that the OS tell it as available, maybe in your case you had container defaults set by Docker. – zakmck Jun 30 '21 at 17:23