JBoss Modular Service Container (JBoss MSC) is a lightweight highly concurrent DI container for Java. It is used as foundation for the application server (JBoss EAP / WildFly). In this short article we will learn what are the basic setting that affect the configuration of JBoss MSC,
An overview of JBoss MSC
Each service successfully installed into MSCs has an associated service controller with it. When the application server starts, you can see that the MSC service threads kick in:
2021-11-28 15:18:57,833 INFO [org.jboss.weld.Version] (MSC service thread 1-2) WELD-000900: 3.1.8 (Final) 2021-11-28 15:18:57,961 INFO [org.infinispan.CONFIG] (MSC service thread 1-1) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated. 2021-11-28 15:18:57,963 INFO [org.infinispan.CONFIG] (MSC service thread 1-1) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
Then, every successfully installed service is stored in service container. A Service container provides information about available services and provides accessors for retrieving service controllers associated with installed services. Service container also provides shutdown mechanism to stop it:
2021-11-28 15:19:49,923 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0004: Undertow 2.2.12.Final stopping
Changing the number of threads used by MSC
The number of MSC threads is a multiple of 2 so this may be a default thread pool size fitting CPU cores available on your machine. If these are all in use during start up, the thread pool may need to be increased
The system property “org.jboss.server.bootstrap.maxThreads” controls the number of threads run by the MSC service. You can change it as follows:
-Dorg.jboss.server.bootstrap.maxThreads=20
The system property org.jboss.server.bootstrap.maxThreads cannot be set via the xml configuration file or from a management client; it’s value must be known at initial process start so it can only set
from the command line as shown above.