A common cause of performance problems is when request handling threads get hung up waiting for a resource from a resource pool that has become unresponsive. To limit this problem, you can set the ResourcePool
’s creationTimeLimit
and maxPendingCreations
properties.
creationTimeLimit
When creationTimeLimit
is set, if a resource creation fails and the attempt exceeded the value of creationTimeLimit
in milliseconds, the resource pool is disabled. In addition, before an attempt to create a resource occurs, a check is made to see if a resource creation attempt already in progress has exceeded the creationTimeLimit
. If so, the resource pool is disabled.
maxPendingCreations
If you set the maxPendingCreations
property, the resource pool has a limit on the maximum number of resource creation attempts that can be pending at one time. This can prevent a situation where all available request handling threads are tied up trying to create resources in an unresponsive resource pool.
The resource pool is disabled if the maxPendingCreations
property is set to a value other than zero, and the following conditions are also true:
The resource pool is not in its startup cycle.
The minimum resources (set by the
min
property of the resource pool) is greater than zero.There are no valid resources being managed by the resource pool.
The number of pending resource creation attempts exceeds the value of the
maxPendingCreations
property.
Disabled ResourcePools
When a resource pool is marked as disabled, it can still attempt to create resources when a thread attempts to check out resources from the pool. However, only one thread at a time can do so. Any other threads are returned a ResourcePoolException
. This prevents more than one thread at a time from getting hung on a disabled pool. The resource pool is not shut down; it is simply marked disabled so threads seeking resources know that the resource pool is not behaving properly. The pool is marked enabled as soon as there is a successful resource creation.