How can I track / control open / close JMS connections in Glassfish?

I have a JavaEE application that is currently deployed to Glassfish, for which I wrote a load test, which in less than one hour (at the moment - speedy improvements to failure) will exhaust the JMS connection pool and break Glassfish into an insanely bad message

Incoming connections are equal to the maximum pool size and the elapsed maximum timeout. Cannot allocate more connections.

I would like to see which of the JavaEE components leak JMS connections. I think for memory I could use a profiler as well as use it for JDBC connections. But what is the best way to track open / closed JMS connections and the components that create them and not release them?

+5
source share
2 answers

Try using imqcmd to monitor your JMS addresses. It provides basic but useful commands (list, clear, create ...)

It is located at $GLASSFISH_HOME/mq/bin

Try the following commands:

  • enter all your jms addresses
  ./imqcmd list dst 
  • print information about brokers
  ./imqcmd query brk 
  • Show statistics (I think this is what you are looking for). Statistics are updated every 5 seconds by default.
  ./imqcmd metrics dst -tq -n jms / myQueue -m rts 

-m rts means "Message rate". See documentation for other metric details (./imqcmd -h ;-))

Please note: each command asks for a username and password. admin / admin is the default username / password (! = asadmin credentials)

+4
source

In the Glassfish 3.1 console, you can check the JMS physical statistics. This is on the “Physical Assignments” tab on the server → JMS → Click on “View Statistics” (you can copy the link and refresh this page to get the latest result, for example, the number of messages in the queue and memory at that moment)

I also think that the best way to monitor JMS Queues is to insert some log information into your classes to control who is producing or consuming messages (and know who opens / closes connections).

0
source

All Articles