3.14.2 Functionality available with connection pooling
(1) Connection pool warming up
The Connection pool warming up is a functionality that pools the minimum number of connections defined in the connection pool settings, in advance, during the resource start processing executed when the server or resource adapter is started. Due to this, you can improve the response to the connection requests made immediately after you begin using the connection pool.
You set up the connection pool warming up functionality as a resource adapter attribute (property). For details on the content that can be specified in the resource adapter property definitions, see 3.14.10 Settings in the execution environment.
(2) Connection count adjustment functionality
The connection count adjustment functionality reduces the unnecessary connections in the connection pool from the minimum specified connection pool value up to the maximum value in a phased manner. If you enable this functionality, the number of connections in the pool is gradually reduced up to a number appropriate for the actual operation results, so you can reduce the cost of generating the connections and save resources when the minimum specified connection pool value is exceeded.
You can also set a timeout value for the response time for deleting the connections during the connection count adjustment. If a server or network error occurs and no response returns from the resource, a response might not be returned even for the connection deletion processing. In this way, even if the response does not return from the resource, you can terminate the connection deletion processing and continue the rest of the processing by specifying a timeout value.
- Operations of the connection count adjustment functionality
- If you use the connection count adjustment functionality, the number of connections in the pool is adjusted at the maximum number of connections used concurrently during the period between the previous connection count adjustment and the next connection count adjustment. During the connection count adjustment, if the number of connections in the pool is greater than the maximum number of concurrently used connections, the connection deletion processing will operate. For example, if the number of connections in the pool is 8 currently, and the maximum number of connections used concurrently during the period between the previous connection count adjustment and the next connection count adjustment is 5, there are 3 more connections in the pool, so three connections are deleted from the connection pool, and the adjusted connection count becomes 5.
- Note that the connection count adjustment functionality operates at regular intervals.
- For details on the settings for the connection count adjustment functionality, see 3.14.10 Settings in the execution environment.
- Timeout in the connection deletion processing
- You can set a timeout value for the response time for the connection deletion processing of the connection count adjustment functionality. Note that you can specify any value (default value is 5 seconds) as the timeout value for the connection deletion processing, in the keys specified for the J2EE server in the Easy Setup definition file.
- However, if the maximum value of the connection pool is unlimited, the timeout value of the connection deletion processing is disabled.
- Also, the connection management threads are used for the connection deletion processing timeout; therefore, if you specify a timeout for the connection deletion processing, a lot of memory is consumed compared to when the timeout is not set. If you want to set a timeout, estimate the required amount of memory appropriately.
- For details on the connection management threads, see 3.15.1 Detecting the connection errors.
(3) Connection sweeper operations
The connection sweeper functionality that is used to destroy the unused connections in the connection pool at regular intervals operates as follows:
- The connection sweeper operates after the lapse of the SweeperInterval value from the termination of the previous connection sweeper operation.
- The connection sweeper monitors the unused connections in the pool.
The unused connections, for which the time elapsed since the last usage is the ConnectionTimeout value or more, are destroyed. The connection sweeper does nothing in the case of the unused connections, for which the time elapsed since the last usage is less than the ConnectionTimeout value.