GlassFish ConnectionPool Test

A connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required. Connection pools are used to enhance the performance of executing commands on a database. Opening and maintaining a database connection for each user, especially requests made to a dynamic database-driven website application, is costly and wastes resources. In connection pooling, after a connection is created, it is placed in the pool and it is used over again so that a new connection does not have to be established. Connection pooling also cuts down on the amount of time a user must wait to establish a connection to the database. As opposed to this, the lack of adequate connections in the pool can prolong the time taken to connect to a database. To analyze the impact of connection pools on the database connection time, use the GlassFish ConnectionPool test. This test auto-discovers the connection pools configured on the GlassFish server, tracks the usage of connections in each pool, and reports whether/not sufficient connections are available in the pools to handle the connection requests to the GlassFish server. This way, the test points you to connection pools that are starved for connections and helps you assess how this impacts connection requests to the GlassFish server.

Target of the test : A GlassFish server

Agent deploying the test : An internal/remote agent

Outputs of the test : One set of results for each connection pool on the Java application being monitored.

Configurable parameters for the test
Parameters Description

Test Period

How often should the test be executed.

Host

The host for which the test is to be configured.

Port

The port number at which the specified host listens

JMX Remote Port

To collect metrics from a GlassFish Enterprise server, the eG agent monitoring that server should be configured to use JMX to connect to the JRE used by the server and pull out the metrics of interest. By default, JMX support is enabled for the JRE used by the GlassFish Enterprise Server. The JMX connector listens on port 8686 by default. Therefore, type 8686 as the JMX Remote Port. If JMX listens on a different port in your environment, then specify the same here. To know the port at which JMX listens, open the domain.xml file in the <GLASSFISH_INSTALL_DIR>\Sun\AppServer\domains\domain1\config directory and look for the code block shown below:

<jmx-connector accept-all="false" address="0.0.0.0" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false">

The port number specified against the Port parameter in the code block above refers to the JMX Remote Port.

JMX User,
JMX Password, and Confirm Password

By default, the JMX connector on the GlassFish Enterprise Server requires authentication. To enable the eG agent to use JMX therefore, you need to configure the agent with the credentials of a user who is authorized to use JMX. Typically, the GlassFish administrator has the right to use JMX. You can hence configure the JMX User and JMX Password parameters with the credentials of the administrator. However, if you prefer not to expose the credentials of an administrator owing to security considerations, you can use the credentials of any other user with access rights to JMX. To know the name of such a user, open the domain.xml file in the <GLASSFISH_INSTALL_DIR>\Sun\AppServer\domains\domain1\config directory and look for the code block shown below:

<jmx-connector accept-all="false" address="0.0.0.0" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false">

The user name specified against the auth-realm-name parameter in the code block above can be configured as the JMX User, and the Password of that user can be specified against JMX Password. Confirm the JMX Password you specify by retyping that password in the Confirm Password text box.

JNDIName

The JNDIName is a lookup name for connecting to the JMX connector. By default, this is jmxrmi. If you have registered the JMX connector in the RMI registry using a different lookup name, then you can change this default value to reflect the same. 

JMX Provider

This test uses a JMX Provider to access the MBean attributes of the GlassFish Enterprise server and collect metrics. Specify the package name of this JMX Provider here. By default, this is set to com.sun.jmx.remote.protocol.

Timeout

Specify the duration (in seconds) for which this test should wait for a response from the GlassFish Enterprise server. If there is no response from the server beyond the configured duration, the test will timeout. By default, this is set to 240 seconds. 

Measurements made by the test
Measurement Description Measurement Unit Interpretation

Total beans in cache

Indicates the number of EJBs in the EJB cache.

Number

 

Used connections

Indicates currently used connections in this pool.

Number

A high value indicates a large number of connections to the database.

Free connections

Indicates the total number of free connections in this pool.

Number

 

Connection waiting time

Indicates waiting time of the last request that was serviced in the pool.

Secs

 

Average connection waiting time

Indicates average waiting time per successful request to this pool.

Secs

The effectiveness of a connection pool can be measured by observing how much it reduces the connection time. A low value for this measure is hence a clear indicator that the connection pool is effective in reducing the wait time of connection requests. A high value on the other hand, could indicate that the pool is running out of connections often, causing connection requests to wait for long periods of time to be processed.

Connections timedout

Indicates the total number of connections in this pool that timed out between the start time and the last sample time.

Number

 

Potential connection leak

Indicates currently available potential connection leaks.

 

Number

Ideally, the value of this measure should be 0.

Waiting queue length

Indicates the number of connection requests to this pool that are currently in waiting queue.

Number

A consistent increase in the value of this measure could indicate that there are not enough connections in the pool to service the connection requests received by the GlassFish server.

Failed connections

Indicates number of connections in this connection pool that failed validation from the start time until the last sample time.

Number

Ideally, the value of this measure should be 0.

Released connections

Indicates the current number of logical connections released to this pool.

Number

 

Destroyed connections

Indicates the number of physical connections in this pool that were destroyed since the last reset.

Number