Creating and Monitoring Custom Executor for AJP or Http Connectors in EAP6
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
- How to access Tomcat status page in EAP 6.
- Is there a way available to create a Separate Thread Executor for Http Connector available in Web Subsystem?
- How to monitor the custom Executor thread pool statistics?
- How to get detailed description for thread pool executors and its attributes?
- How to monitor queue-length for HTTP requests for jboss EAP 6.1.0 via Jconsole?
- How to to implement a non blocking HTTP thread pool?
- How to customize web thread pool?
- Is there a JBoss CLI command to change the AJP thread pool in domain mode?
- How to create thread pool for ajp/http connector in jboss eap6 server?
Resolution
- The Tomcat status page is not available in EAP 6. In JBoss EAP 6, For monitoring purposes, CLI and Management Console can be used.
- In JBoss EAP6, the JBoss Web subsystem uses an internal thread pool by default. Its only configurable attribute is the
max-connectionsparameter on the connector, which sizes the connector's corresponding internal thread pool (default is 512 * #ofCPUcores for default JIO endpoints or 32 * #ofCPUcores for native APR endpoints). - You can define a specific thread pool in the threads subsystem and associate a web connector with it (set the thread pool name in the executor property of the connector).
- Thread pools in the threads subsystem can be monitored using Management Console or CLI or using other monitoring utilities.
Creating HTTP Executor
/subsystem=threads/bounded-queue-thread-pool=http-executor/:add(queue-length=30,max-threads=30,core-threads=30,allow-core-timeout=true,keepalive-time={time=10,unit=SECONDS})
/subsystem=web/connector=http/:write-attribute(name=executor,value=http-executor)
Creating AJP Executor
/subsystem=threads/bounded-queue-thread-pool=ajp-executor/:add(queue-length=30,max-threads=30,core-threads=30,allow-core-timeout=true,keepalive-time={time=10,unit=SECONDS})
/subsystem=web/connector=ajp/:write-attribute(name=executor,value=ajp-executor)
Configuring Executor
- Above will generate following kind of configuration to create a Bounded Queue Thread Poolin Profile:
<subsystem xmlns="urn:jboss:domain:threads:1.1">
<bounded-queue-thread-pool name="http-executor" allow-core-timeout="true">
<core-threads count="30"/>
<queue-length count="30"/>
<max-threads count="30"/>
</bounded-queue-thread-pool>
</subsystem>
Associating Executor to Http Connector
- Once the Executor is created then associate it with a particular Connector as following [executor="http-executor"]
<subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" executor="http-executor"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
Associating Executor to AJP Connector
- Once the Executor is created then associate it with a particular Connector as following [executor="ajp-executor"]
<subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp" executor="ajp-executor"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
Monitoring
- Once it is configured, then the Web Executor Thread pool can be monitored like so:
[standalone@localhost:9999 /] /subsystem=threads/bounded-queue-thread-pool=http-executor:read-resource(include-runtime=true)
{
"outcome" => "success",
"result" => {
"allow-core-timeout" => true,
"core-threads" => 30,
"current-thread-count" => 12,
"handoff-executor" => undefined,
"keepalive-time" => undefined,
"largest-thread-count" => 12,
"max-threads" => 30,
"name" => "http-executor",
"queue-length" => 30,
"rejected-count" => 0,
"thread-factory" => undefined
}
}
- Once it is done then the AJP Executor Thread pool can be monitored as following:
[standalone@localhost:9999 /] /subsystem=threads/bounded-queue-thread-pool=ajp-executor:read-resource(include-runtime=true)
{
"outcome" => "success",
"result" => {
"allow-core-timeout" => true,
"core-threads" => 30,
"handoff-executor" => undefined,
"keepalive-time" => undefined,
"max-threads" => 30,
"name" => "ajp-executor",
"queue-length" => 30,
"thread-factory" => undefined
}
}
-Note in domain mode to see the runtime stats, the command needs to be invoked against an actual server instance and not the profile, for example:
/host=hostname/server=servername/subsystem=threads/bounded-queue-thread-pool=http-executor:read-resource(include-runtime=true)
Detailed description about thread pool executors and its attributes
[standalone@localhost:9999 /] /subsystem=threads:read-resource-description(recursive-depth=1)
{
"outcome" => "success",
"result" => {
"description" => "The threading subsystem, used to declare manageable thread pools and resources.",
"attributes" => {},
"operations" => undefined,
"children" => {
"bounded-queue-thread-pool" => {
"description" => "A set of thread pools where tasks are stored in a bounded-size queue and where if no space is available in the queue tasks will either be discarded or passed off to another 'handoff-executor' for execution.",
"model-description" => {"*" => {
"description" => "A thread pool executor with a bounded queue where threads submittings tasks will not block. Such a thread pool has a core and maximum size and a specified queue length. When a task is submitted, if the number of running threads is less than the core size, a new thread is created. Otherwise, if there is room in the queue, the task is enqueued. Otherwise, if the number of running threads is less than the maximum size, a new thread is created. Otherwise, the task is handed off to the designated handoff executor, if one is specified. Otherwise, the task is discarded.",
"attributes" => {
"core-threads" => {
"type" => INT,
"description" => "The core thread pool size which is smaller than the maximum pool size. If undefined, the core thread pool size is the same as the maximum thread pool size.",
"expressions-allowed" => true,
"nillable" => true,
"min" => 0L,
"max" => 2147483647L,
"access-type" => "read-write",
"storage" => "configuration",
"restart-required" => "no-services"
},
...........................
},
[1] How to connect to JBoss EAP 6 using JConsole
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.