Usage:
• -XX:ActiveProcessorCount=N where N is a positive integer
Example:
java -XX:ActiveProcessorCount=2
Description:
The -XX:ActiveProcessorCount option is used to specify the number of active
CPUs to be used by the JVM, which the JVM uses to calculate the size of thread
pools for garbage collection and other uses.
The number of active CPUs is normally determined by the number of
CPUs reported by the operating system. Overring this number with the
-XX:ActiveProcessorCount option can be useful when running multiple Java
processes in Docker containers.
Default Value:
The default value of -XX:ActiveProcessorCount is the number of CPUs reported by the operating system. This may or may not match the number of
physical CPUs, for example it may be reported as a lower number in a virtualized
environment.
Errors:
When the argument of -XX:ActiveProcessorCount is not a number, the JVM
prints an error message and exits. For example:
java -XX:ActiveProcessorCount=XXX
prints the following error:
Improperly specified VM option 'ActiveProcessorCount=XXX'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Arguments Related to -XX:ActiveProcessorCount:
TODO: link to -XX:+UseContainerSupport
Related Posts:
• Java in Docker: CPU Limits & server class machine.
NOTE:
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments
Edit your Comment