Hitachi

Hitachi Application Server V10 User's Guide (For Windows® Systems)


3.5 Connection management

Connection management is used to manage connections to a database server by using the JDBC connection pool. By managing the number of connections to be pooled in the JDBC connection pool, the processing time for database access can be reduced. In addition, by using the connection error detection function, processing can continue even if a failure occurs in a connection of the JDBC connection pool.

Connection management mechanism

Because it takes time to establish a connection to the database server, a certain number of connections are pooled in the JDBC connection pool. When a connection collection request is received, a connection pooled in the JDBC pool is returned. By reusing connections, this mechanism reduces the time required for database access.

The following figure shows the connection management mechanism.

[Figure]

Connection error detection function

When the connection error detection function receives a connection collection request, it checks whether there is a failure in the connections of the JDBC connection pool and then returns a connection for which no failure has occurred. Through this operation, even if a failure occurs in a connection due to a resource shutdown or network failure, processing can continue by using a connection for which no failure has occurred.

The following figure shows the connection error detection function.

[Figure]

If a large number is set for the maximum number of connections in a connection pool, a larger amount of memory is required.

If server failures or network failures occur frequently, the resources required for detecting connection failures become insufficient, and connection collection requests fail. When this happens, the KDKD20004-W message is output. Similarly, when you want to discard connections because a timeout error occurred in the connection error detection function, if the resources required for this operation become insufficient due to a large number of failures, a response for discarding connections might not be returned. When this happens, the KDKD20001-W message is output.

Note that, when the connection error detection function is being used, if a new connection is established before a failed connection is discarded, the maximum number of concurrent connections for DBMS might temporarily exceed the connection pool size.

Tuning the JDBC connection pool

When creating a connection pool, you need to tune the values so that the number of connections set in the connection-destination database for physical connections is greater than or equal to the maximum size of the connection pool.

For details on the number of connections set in the connection-destination database, see the documentation of the applicable database.

Estimating the maximum number of concurrent connections for DBMS

The formula for estimating the maximum number of concurrent connections for DBMS is shown below. The maximum number of concurrent connections when using multiple JDBC connection pools is the sum of the results of this formula.

Maximum number of concurrent connections for DBMS 
= JDBC_connection_pool_size + a#
#:

+ a indicates that the maximum number of concurrent connections for DBMS might temporarily exceed the size of the JDBC connection pool. When the connection error detection function is being used, if a new connection is established before a failed connection is discarded, the maximum number of concurrent connections for DBMS might temporarily exceed the connection pool size. Note that the maximum value of + a is the same size as the connection pool size.