I'm using Oracle's Java 1.8.0_231.
What is the effect of setting -XX:ActiveProcessorCount=n? I'm not a C++ guy, but I think I see in the HotSpot source code these two uses:
- Influence the number of HotSpot compiler threads
- Influence the number of GC threads
However, does it actually limit the number of CPUs that the JVM can use? The Java 10 release notes plainly say:
In addition, this change adds a JVM option that provides the ability to specify the number of CPUs that the JVM will use.
My concern is that I have test results (outside of any Docker, CF, etc container) that seem to show the app using all 8 CPUs equally instead of the 4 I had set:
So, should setting ActiveProcessorCount actually limit the number of CPUs the JVM uses? I don't see anything in the HotSpot code that does that and my test results seem to also say no.
thanks
Runtime.getRuntime().availableProcessors();
which is often used for all kinds of pool sizing and other such calculations. – Blubber