Search code examples
jbossjboss7.xwildflywildfly-8

Wildfly: How to configure worker threads in IO subsystem dynamically


I want to dynamically configure following section in wildfly-8.2.0 in standalone.xml:

<worker name="default" io-threads="100" task-max-threads="100"/>

Basically I don't want these values to be hardcoded and calculate them at the time of server startup and pass them as jboss boot parameters. I did something like this:

 <worker name="default" io-threads="${my.io.threads:100}" task-max-threads="${my.task.max.threads:1000}"/>

I am passing these parameters as -Dmy.io.threads and -Dmy.task.max.threads while starting wildfly server. But it's failing to parse standalone.xml with following exception:

ERROR [org.jboss.as.server] (Controller Boot Thread) JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:112) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.ServerService.boot(ServerService.java:331) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:259) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]
Caused by: java.lang.NumberFormatException: For input string: "${my.io.threads:100}"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) [rt.jar:1.8.0_45]
    at java.lang.Integer.parseInt(Integer.java:569) [rt.jar:1.8.0_45]
    at java.lang.Integer.parseInt(Integer.java:615) [rt.jar:1.8.0_45]
    at org.jboss.dmr.StringModelValue.asInt(StringModelValue.java:139) [jboss-dmr-1.2.0.Final.jar:1.2.0.Final]
    at org.jboss.dmr.ModelNode.asInt(ModelNode.java:240) [jboss-dmr-1.2.0.Final.jar:1.2.0.Final]
    at org.jboss.as.controller.AttributeParser.parse(AttributeParser.java:116) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.AttributeParser.parse(AttributeParser.java:82) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.AttributeParser$DiscardOldDefaultValueParser.parse(AttributeParser.java:177) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.AttributeParser.parseAndSetParameter(AttributeParser.java:61) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.PersistentResourceXMLDescription.parse(PersistentResourceXMLDescription.java:83) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.PersistentResourceXMLDescription.parseChildren(PersistentResourceXMLDescription.java:135) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.controller.PersistentResourceXMLDescription.parse(PersistentResourceXMLDescription.java:107) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    at org.wildfly.extension.io.IOSubsystemParser_1_0.readElement(IOSubsystemParser_1_0.java:71)
    at org.wildfly.extension.io.IOSubsystemParser_1_0.readElement(IOSubsystemParser_1_0.java:41)
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:1131) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:458) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:145) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:107) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:104) [wildfly-controller-8.2.0.Final.jar:8.2.0.Final]
    ... 3 more

I have read that IO subsystem doesn't support expressions. Is there any other way to achieve this? Is there any internal parameter which when passed at boot time would override these values?


Solution

  • Wildfly-8.2.0 doesn't support expressions for io-threads and task-max-threads attributes in worker section of IO subsystem. I have raised a Jira ticket under WFCORE project to have this addressed by Jboss team.