WAS v8.5 > Reference > Sets Connection pool properties page
To set connection pool properties...
Resources | JDBC | Data Sources | data_source | [Additional Properties] Connection pool properties
Resources | JMS | Queue connection factories | queue_connection_factory | Additional Properties] Connection pool
Connection pooling is not supported in an application client. The application client calls the database directly and does not go through a data source.
To use the getConnection() request from the application client, configure the JDBC provider in the application client deployment descriptors, using Rational Application Developer or an assembly tool. The connection is established between application client and the database. Application clients do not have a connection pool, but we can configure JDBC provider settings in the client deployment descriptors.
Connection timeout
Interval, in seconds, after which a connection request times out and a ConnectionWaitTimeoutException is thrown.
This value indicates the number of seconds that a connection request waits when there are no connections available in the free pool and no new connections can be created. This usually occurs because the maximum value of connections in the particular connection pool has been reached.
For example, if Connection timeout is set to 300, and the maximum number of connections are all in use, the pool manager waits for 300 seconds for a physical connection to become available. If a physical connection is not available within this time, the pool manager initiates a ConnectionWaitTimeout exception. In most cases, you should not retry the getConnection() method; if a longer wait time is required you should increase the Connection timeout setting value. If a ConnectionWaitTimeout exception is caught by the application, review the expected connection pool usage of the application and tune the connection pool and database accordingly.
If the Connection timeout is set to 0, the pool manager waits as long as necessary until a connection becomes available. This happens when the application completes a transaction and returns a connection to the pool, or when the number of connections falls below the value of Maximum Connections, and a new physical connection is created.
If Maximum Connections is set to 0, an infinite number of physical connections are enabled, and the Connection timeout value is ignored.
Units Seconds Default 1.0 Range 0 to max int
Maximum connections
Maximum number of physical connections that we can create in this pool.
These are the physical connections to the backend resource. When this number is reached, no new physical connections are created. The requester waits until a physical connection that is currently in use returns to the pool, or until a ConnectionWaitTimeoutException error displays. For example, if the Max Connections value is set to 5, and there are 5 physical connections in use, the pool manager waits for the amount of time specified in Connection timeout for a physical connection to become free.
Knowing the number of connection pools that can potentially request connections from the backend, such as a DB2 database or a CICS server, helps you determine a value for the Maximum Connections property.
For multiple stand-alone application servers that use the same data source configuration, or J2C connection factory configuration, a separate physical connection pool exists for each server. If you clone these same application servers, WAS (base) implements a separate connection pool for each clone.
All of these connection pools correspond to the same data source or connection factory configuration. Therefore all of these connection pools can potentially request connections from the same backend resource, at the same time. The single Maximum Connections value set on this console panel applies to every one of these connection pools. Consequently, setting a high Maximum Connections value can result in a load of connection requests that overwhelms your backend resource.
Default 10 Range 0 to maximum integer If Max Connections is set to 0, the Connection timeout value is ignored.
For better performance, set the value for the connection pool lower than the value for the maximum thread pool connections of the web container. To configure this setting click Servers > Server types > WebSphere application servers > server > Thread Pools, and modify the web container property. Lower settings, such as 10-30 connections, perform better than higher settings, such as 100.
We can use the Tivoli Performance Viewer to find the optimal number of connections in a pool. If the number of concurrent waiters is greater than 0, but the processor load is not close to 100%, consider increasing the connection pool size. If the Percent Used value is consistently low under normal workload, consider decreasing the number of connections in the pool.
Minimum connections
Minimum number of physical connections to maintain.
If the size of the connection pool is at or below the minimum connection pool size, the Unused timeout thread does not discard physical connections. However, the pool does not create connections solely to ensure the minimum connection pool size is maintained. Also, if you set a value for Aged timeout, connections with an expired age are discarded, regardless of the minimum pool size setting.
For example, if the Minimum Connections value is set to 3, and one physical connection is created, the Unused timeout thread does not discard that connection. By the same token, the thread does not automatically create two additional physical connections to reach the Minimum Connections setting.
Default 1 Range 0 to max int
Reap time
Interval, in seconds, between runs of the pool maintenance thread.
For example, if Reap Time is set to 60, the pool maintenance thread runs every 60 seconds. The Reap Time interval affects the accuracy of the Unused timeout and Aged timeout settings. The smaller the interval, the greater the accuracy. If the pool maintenance thread is enabled, set the Reap Time value less than the values of Unused timeout and Aged timeout. When the pool maintenance thread runs, it discards any connections remaining unused for longer than the time value specified in Unused timeout, until it reaches the number of connections specified in Minimum Connections. The pool maintenance thread also discards any connections that remain active longer than the time value specified in Aged timeout.
The Reap Time interval also affects performance. Smaller intervals mean the pool maintenance thread runs more often and degrades performance.
To disable the pool maintenance thread, set Reap Time to 0, or set both Unused timeout and Aged timeout to 0. The recommended way to disable the pool maintenance thread is to set Reap Time to 0, and Unused timeout and Aged timeout are ignored. However, if Unused Timeout and Aged Timeout are set to 0, the pool maintenance thread runs. Physical connections which timeout due to non-zero timeout values are discarded as well as those connections residing in a used pool (or shared pool) because they have been held longer than the time interval set for Aged Timeout.
Units Seconds Default 1.0 Range 0 to max int
Unused timeout
Interval in seconds after which an unused or idle connection is discarded.
Set the Unused timeout value higher than the Reap timeout value for optimal performance. Unused physical connections are only discarded if the current number of connections exceeds the Minimum Connections setting. For example, if the unused timeout value is set to 1.0, and the pool maintenance thread is enabled (Reap Time is not 0), any physical connection that remains unused for 2 minutes is discarded.
The accuracy and performance of this timeout are affected by the Reap Time value. See Reap time for more information.
Units Seconds Default 1800 Range 0 to max int
Aged timeout
Interval in seconds before a physical connection is discarded.
Setting Aged timeout to 0 supports active physical connections remaining in the pool indefinitely. Set the Aged timeout value higher than the Reap timeout value for optimal performance.
For example, if the Aged timeout value is set to 1200, and the Reap Time value is not 0, any physical connection that remains in existence for 1200 seconds (20 minutes) is discarded from the pool. The only exception is if the connection is involved in a transaction when the aged timeout is reached, the application server will not discard the connection until after the transaction is completed and the connection is closed.
The accuracy and performance of this timeout are affected by the Reap Time value. See Reap time for more information.
Units Seconds Default 0 Range 0 to max int
Purge policy
How to purge connections when a stale connection or fatal connection error is detected.
Valid values are EntirePool and FailingConnectionOnly.
Defaults:
- EntirePool for J2C connection factories and JMS-related connection factories
- EntirePool for WebSphere Version 4.0 data sources
- EntirePool for current version data sources that we create through the dmgr console
- EntirePool for current version data sources that you script through wsadmin AdminConfig commands, starting JDBC templates that are built into WAS. For information about the command createUsingTemplate
- FailingConnectionOnly for data sources that you script in wsadmin tool without starting JDBC templates
:
Range:
- EntirePool
All connections in the pool are marked stale. Any connection not in use is immediately closed. A connection in use is closed and issues a stale connection Exception during the next operation on that connection. Subsequent getConnection() requests from the application result in new connections to the database opening. When using this purge policy, there is a slight possibility that some connections in the pool are closed unnecessarily when they are not stale. However, this closure is a rare occurrence. In most cases, a purge policy of EntirePool is the best choice.
- FailingConnectionOnly
Only the connection that caused the stale connection exception is closed. Although this setting eliminates the possibility that valid connections are closed unnecessarily, it makes recovery from an application perspective more complicated. Because only the currently failing connection is closed, there is a possibility the next getConnection() request from the application can return a connection from the pool that is also stale. The result is more stale connection exceptions.
The connection pretest function attempts to insulate an application from pooled connections that are not valid. When a backend resource, such as a database, goes down, pooled connections that are not valid might exist in the free pool. This is especially true when the purge policy is failingConnectionOnly; in this case, the failing connection is removed from the pool. Depending on the failure, the remaining connections in the pool might not be valid.
Related concepts:
Relational resource adapters and JCA JDBC providers Connection pooling
Related
Tune connection pools Administer data access applications
Reference:
Administrative console preference settings Administrative console page features Commands for the AdminConfig object using wsadmin.sh WebSphere MQ messaging provider queue connection factory settings WebSphere MQ messaging provider topic connection factory settings