Application based Connection Pool monitoring

A brand new feature in the latest GlassFish 3.1 is monitoring a connection pool based on the application name. Earlier, monitoring statistics could be got at the connection pool level like 



asadmin get server.resources.jdbc-connection-pool.<POOL_NAME>.\*


With this new feature, it is possible to



  1. Get the number of connections in use by an application for the specified connection pool.

  2. Get the number of connections acquired from the connection pool by an application

  3. Get the number of connections released to the connection pool by an application


When monitoring is set to HIGH, using the command line interface, the above information could be got as follows.



asadmin get server.resources.jdbc-connection-pool.application1.
numconnused-current
asadmin get server.resources.jdbc-connection-pool.application1.
numconnacquired-count
asadmin get server.resources.jdbc-connection-pool.application1.
numconnreleased-count


Using AMX (Application Server Management Extenstions), the following program could be used to get the monitoring statistics : numconnfree, numconnacquired and numconnreleased.



public int getValue(String statName) throws Exception {
final String urlStr = "service:jmx:rmi:///jndi/rmi://" +
HOST_NAME + ":" + JMX_PORT + "/jmxrmi";
final JMXServiceURL url = new JMXServiceURL(urlStr);
final JMXConnector jmxConn = JMXConnectorFactory.connect(url);
final MBeanServerConnection connection =
jmxConn.getMBeanServerConnection();
ObjectName objectName =
new ObjectName("amx:pp=/mon/server-mon[server],
type=jdbc-connection-pool-app-mon,
name=resources/testPool/application1");
javax.management.openmbean.CompositeDataSupport returnValue =
(javax.management.openmbean.CompositeDataSupport)
connection.getAttribute(objectName, statName);
return new Integer(returnValue.get("count").toString());
}


The above method gets the value of a monitoring statistic for a particular jdbc connection pool (testPool in this case) for application1. To retrieve attribute values for a connector connection pool, use the ObjectName given below instead



amx:pp=/mon/server-mon[server],
type=connector-connection-pool-mon,
name=resources/testPool/application1



Comments:

hi

Posted by guest on April 21, 2011 at 05:04 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

shalini_m

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today