travelaudience / docker-nexus

A container image for Sonatype Nexus Repository Manager OSS, based on Alpine Linux.
Apache License 2.0
43 stars 43 forks source link

Available CPUs: always 1 #27

Closed jansmets closed 5 years ago

jansmets commented 5 years ago

It seems that Nexus is unable to detect the right amount of CPUs/Cores. Before I file a bug upstream, can you please verify that your set up shows the same? I regularly need bulk delete of blob objects and doing so is always very slow.

varditn commented 5 years ago

How many cpu have you allocated to the NExus pod and how much is Nexus stating yu have?

jansmets commented 5 years ago

No resource limits have been defined in the podSpec. The container has 6C/12T available

# kubectl -n sonatype-nexus  exec -it sonatype-nexus-0 sh
Defaulting container name to nexus.
Use 'kubectl describe pod/sonatype-nexus-0 -n sonatype-nexus' to see all of the containers in this pod.
/opt/sonatype/nexus # nproc
12
/opt/sonatype/nexus #

In Nexus /admin/support/status I see The host system is allocating a maximum of 1 cores to the application. A minimum of 4 is recommended.

The jvm.log says Nexus is started with these args:

-Dinstall4j.jvmDir=/usr/lib/jvm/default-jvm/jre -Dexe4j.moduleName=/opt/sonatype/nexus/bin/nexus -XX:+UnlockDiagnosticVMOptions -Dinstall4j.launcherId=245 -Dinstall4j.swt=false -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Xms1200m -Xmx1200m -XX:MaxDirectMemorySize=2G -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+LogVMOutput -XX:LogFile=../sonatype-work/nexus3/log/jvm.log -XX:-OmitStackTraceInFastThrow -Djava.net.preferIPv4Stack=true -Dkaraf.home=. -Dkaraf.base=. -Dkaraf.etc=etc/karaf -Djava.util.logging.config.file=etc/karaf/java.util.logging.properties -Dkaraf.data=../sonatype-work/nexus3 -Djava.io.tmpdir=../sonatype-work/nexus3/tmp -Dkaraf.startLocalConsole=false -Di4j.vpt=true
jansmets commented 5 years ago

It seems Java looks at the CPU shares, which defaults to '2' if nothing has been specified. Stupid CFS. It detects more cpu's when I explicitly specify resource requests/limits.

varditn commented 5 years ago

So you increased your Nexus pod resource requests/limits and Nexus Identified all the cores? I suspected something like that. Our setup uses 2 cores node but requests less then 1 core and that is what Nexus detect as well. If changing resource requests/limits helped your setup, I will apply the same to ours.

jansmets commented 5 years ago

Correct. I specified the parameter --set nexus.resources.limits.cpu=6 to the helm install and nexus now reports 6 cores : The host system is allocating a maximum of 6 cores to the application.

alexejmdv commented 4 years ago

Hi. Ive the same issue, and after setting nexus.resources.limits.cpu=4, creation of the new pod fails without producing any logs. Does anyone have an idea?

varditn commented 4 years ago

@alexejmdv I would need more details. Dou you have a need with enough available cpu ( at least 4 cores) that the pod can be scheduled to ( with matching taints etc..)

cablespaghetti commented 3 years ago

I've found the fix (all credit to Stack Overflow...) https://stackoverflow.com/questions/56946027/nexus-sonatype-nexus33-17-0-on-docker-tells-its-using-only-one-cpu

My INSTALL4J_ADD_VM_PARAMS environment variable is set to -Xms2048m -Xmx2048m -XX:ActiveProcessorCount=4 and everything seems to work properly now.