Monitoring the EJB container using the CLI

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

In this tutorial we will learn how to gather EJB 3 container statistics from JBoss AS 7 / JBoss EAP using the Command Line Interface. 

So you have deployed your EJBs and you want to know if your configuration is able to meet your requests. Now worry, using the Command Line Interface it's just a minute away from you!
Start the CLI using:


(Or using the Windows equivalent batch).
Then you need to point to the application which contains EJB resources. Supposing you want to monitor an application named cdi-demo.war which contains the Stateless EJB ServiceBean. Here's how to construct the CLI query:

[standalone@localhost:9999 /] /deployment=cdi-demo.war/subsystem=ejb3/stateless-session-bean=ServiceBean:read-resource(include-runtime=true)

"outcome" => "success",
"result" => {
"component-class-name" => "ServiceBean",
"declared-roles" => [],
"execution-time" => 0L,
"invocations" => 0L,
"methods" => {},
"peak-concurrent-invocations" => 0L,
"pool-available-count" => 20,
"pool-create-count" => 3,
"pool-current-size" => 0,
"pool-max-size" => 20,
"pool-name" => "slsb-strict-max-pool",
"pool-remove-count" => 3,
"run-as-role" => undefined,
"security-domain" => "other",
"timers" => [],
"wait-time" => 0L

Some of the metrics are not traced(notably methods executed, execution time and invocations), however you can get an insight on the available Beans in the pool, the number of EJB created and removed from the pool.
The same technique can be used to monitor other resources contained in the application, for example the statistics of a Servlet. As the application is a JSF based application we can gather statistics on the Faces Servlet this way:

[standalone@localhost:9999 /] /deployment=cdi-demo.war/subsystem=web/servlet=Faces\ Servlet:read-resource(include-runtime=true)
"outcome" => "success",
"result" => {
"load-time" => 0L,
"maxTime" => 36L,
"min-time" => 0L,
"processingTime" => 3410L,
"requestCount" => 6,
"servlet-class" => "javax.faces.webapp.FacesServlet",
"servlet-name" => "Faces Servlet"

Related articles available on

How do I get the list of MBeans with twiddle?

  JBoss provides a simple command line tool that allows for inte

How to count active session with twiddle ?

  There are some well known alternatives to count the number of

How do I run garbage collector from shell?

  You can suggest JBoss to run the garbage collector in differen

How do I check my application status from shell?

  This is a two process step: at first you need to retrieve the

How do you shut down multiple JBoss instances?

  Supposing you have configured 2 instances of JBoss, one on por

twiddle reference guide

Please note: twiddle is not available any more as default Command