- In the left panel of the web console, expand Resources > JDBC > Data sources.
- Select a data source.
- Select Connection pool properties.
The image below displays the default connection pool properties for a data source.
Connection timout / Maximum connections
A connection timeout will usually occur when there are no more available connections in a connection pool (aka database), and will produce a ConnectionWaitTimeout exception. In this example, the maximum number of connections to the database is 10. Each database has a certain number of maximum connections. You will need to consult with the database documentation to know the maximum number of connections to the database. Setting the connection timeout to 0 will disable the timeout, which means that the attepted connection will continue indefinitely.
If you have multiple data sources connecting to the same backend database, you will need to be careful not to overload the backend database. For example, if you have 10 data sources with a maximum connections of 50, this creates a maximum of 500 possible connects to the same backend database, which may overload the database, or reduce the performance of the database. It is generally a good idea to se the maximum allowed connects to be less than the maximum threads of a web container.
Reap time / Unused timeout / Aged timeout
Reap time is the number of seconds between each maintenance thread. The maintenance thread will destroy connections to the database that have been inactive longer than the unused and/or aged timeout. For example, if the unused timeout is 1800 seconds, and a connection has been inactive longer than 1800 seconds, the maintenance thread will discard the connection until the minimum connections are reached. Similarly, if the aged timeout is 2000 seconds, connections that have been inactive longer than 2000 seconds will be discarded, regardless of the minumum connections value. Reap time can be disabled by setting the value to 0.
The only difference between unused timeout and aged timeout is that with the unused timeout, connections will only be discarded if the current number of connections exceeds the minimum connection setting. With aged timeout, connections are discarded, regardless of the minimum connections setting.
You usually do not want to decrease the reap time value, as this will decrease the time between maintenance threads, which will put more traffic on the network.
Purging stale connections
The purge policy drop-down has two options, EntirePool or FailingConnectionOnly. This tells WebSphere what to do when a stale connection or fatal connection error is detected. Changes made to the purge policy may improve the response time of an application.
With EntirePool, all connections are destroyed, so connections that are needed will need to be reestablished to the database. There is a possibility that some valid connection may be mistakenly closed, but this is unlikely.
With FailingConnectionOnly, only connections that have the StaleConnectionException are closed, which eliminates the possibility of closing a valid connection. There are some possible issues with this, such as subsequent connections be mistakenly flagged as stale instead of valid. For this reason, EntirePool is usually the preferred option.