Search code examples
connectionwildflywildfly-8

How to get open HTTP connections count in Wildfly 8.2.0 using JMX?


I need to get some metrics from Wildfly/Undertow, specifically open/max HTTP connections and used threads and correlate it with open database connection count, which I am able to read using jboss-cli:

/subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(recursive=true,include-runtime=true)

Is there a way to obtain the HTTP connection statistics in Wildfly 8.2?


Solution

  • In Wildlfy you configure the http connector thread pool specifying a worker configured via the IO subsystem:

    IO Subsystem config example:

        <subsystem xmlns="urn:jboss:domain:io:1.1">
            <worker name="my-worker" io-threads="24" task-max-threads="30"  stack-size="20"/>
            <worker name="default" />
            <buffer-pool name="default"/>
        </subsystem>
    

    The worker then gets added to the http-listener (or ajp-listener) using the worker attribtue:

    <http-listener name="default" worker="my-worker" socket-binding="http"/>
    

    The IO Subsystem uses the XNIO API, that exposes the statistics in the Mbean org.xnio/Xnio/nio/my-worker. You can have a look at them with a jmx-client or jvisualvm:

    enter image description here

    enter image description here But I have no idea how you can read them via jboss-cli.