Java process as non-root consumes 100% processor, but with root privileges

I am trying a Java container application with Docker. When I run this container as a non-root user, the processor load goes up to 100% and stays there. However, with the root, he behaves much better, sitting about 2%.

# docker run -d -p 8006:8006 -u root --name root app:latest
# docker run -d -p 8007:8006 -u nonroot --name nonroot app:latest                    
# ps aux | grep java
root     26537  9.2  4.1 174800 115636 ?       Sl   10:14   0:02 /opt/app/jvm16/bin/java -Xmx128M -Xms128M […]
nonroot  26808 94.8  6.2 202744 175368 ?       Sl   10:15   0:08 /opt/app/jvm16/bin/java -Xmx128M -Xms128M […]

The application functions the same with the root or non-root user (it does not hang). But if I run the same application on a real (not inside the container) server, CPU usage is great for root or non-root, hinting at the reason associated with the container.

Nothing (that I can find) on the Docker host provides insight, and java dumps inside the container do not tell me anything.

My question is: what could be the explanation for this?

+4
1

: ?

, -, , JVM root ; .

, :

  • jstack, , . 100%, JVM CPU, .
  • strace, , syscalls JVM.
  • , , - .
+4

All Articles