JBoss tuning tip 12: Lots of Requests ? check JBoss thread pool

JBoss thread pool is defined into conf/jboss-service.xml

 <mbean code="org.jboss.util.threadpool.BasicThreadPool"
 <attribute name="Name">JBoss System Threads</attribute>
 <attribute name="ThreadGroupName">System Threads</attribute>
 <attribute name="KeepAliveTime">60000</attribute>
 <attribute name="MaximumPoolSize">10</attribute>
 <attribute name="MaximumQueueSize">1000</attribute>
 <attribute name="BlockingMode">run</attribute>

For most applications this defaults will just work well, however if you are running an application with issues lots of requests to jboss (such as EJB invocations) then monitor your thread pool. Open the Web Console and look for the MBean jboss.system:service=ThreadPool.

 jboss performance tuning

Start a monitor on the QueueSize parameter. Have you got a QueueSize which reaches MaximumPoolSize ? then probably you need to set a higher MaximumPoolSize pool size attribute

Watchout! Speak at first with your sysadmin and ensure that the CPU capacity support the increase in threads.

Watchout! if your threads make use of JDBC connections you'll probably need to increase also the JDBC connection pool accordingly. Also verify that your HTTP connector is enabled to handle that amount of requests.

JBoss tuning tip 13: Check the Embedded web container

JBoss supports connectors for http, https, and ajp. The configuration file is server.xml and it's deployed in the root of JBoss web container (In JBoss 4.2.0 it's:  "JBOSS_HOME\server\default\deploy\jboss-web.deployer")

 <Connector port="8080" address="${jboss.bind.address}"    
 maxThreads="250" maxHttpHeaderSize="8192"
 emptySessionPath="true" protocol="HTTP/1.1"
 enableLookups="false" redirectPort="8443" acceptCount="100"
 connectionTimeout="20000" disableUploadTimeout="true" />

The underlying HTTP connector of JBoss needs to be fine tuned for production settings.  The important parameters are:

maxThreads - This indicates the maximum number of threads to be allocated for handling client HTTP requests. This figure corresponds to the concurrent users that are going to access the application. Depending on the machine configuration, there is a physical limit beyond which you will need to do clustering.

acceptCount - This is the number of request threads that are put in request queue when all available threads are used. When this exceeds, client machines get a request timeout response.

compression - If you set this attribute to “force”, the content will be compressed by JBoss and will be send to browser. Browser will extract it and display the page on screen. Enabling compression can substantially reduce bandwidth requirements of your application.

So how do you know if it's necessary to raise your maxThreads number ? again open the web console and look for the MBean jboss.web:name=http-,type=ThreadPool. The key attribute is currentThreadsBusy. If it's about 70-80% of the the maxThreads you should consider raising the number of maxThreads.  

jboss performance tuning

 Watch out! if you increase the maxThreads count you need to raise your JBoss Thread pool accordingly.

JBoss tuning tip 14:  Turn off JSP Compilation in production

JBoss application server regularly checks whether a JSP requires compilation to a servlet before executing a JSP. In a production server, JSP files won’t change and hence you can configure the settings for increased performance.

Open the web.xml in deploy/jboss-web.deployer/conf folder. Look for the jsp servlet in the file and modify the following XML fragment as given below:


Hungry for Tuning?

     Speed-up your Enterprise Applications with our WildFly Performance Tuning guide!

Ok. now keep reading........JBoss performance tuning part 2