We just wrote a CPU intensive application to benchmark Docker images. It's a Java application that approximates the decimals of Pi.
- If we run
java -jar superpi.jar
it stresses all the cores and takes 30 seconds - If we run
docker run fewlaps/superpi
it stresses only two of the four cores and takes 70 seconds
The Docker image is running the .jar as we do when running it on the host. Why is the Docker image not as fast as running the .jar locally? We expected some difference between running it locally and running it on Docker, but the process takes double the time.
Is there any way to request that Docker use all the CPU?
BTW, the project is published here on GitHub: Fewlaps/SuperPI