Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Current »

The pool configuration provides a way to tune the setting used to setup the pooling associated with various other configuration items. For example a Data Source.

The pool tag itself is not used as a top level configuration item but is instead embedded within other tags.

A pool provides a number of configurable parameters:

  • maxActive controls the maximum number of objects that can be borrowed from the pool at one time. When non-positive, there is no limit to the number of objects that may be active at one time. When maxActive is exceeded, the pool is said to be exhausted. If 'whenExhaustedAction' is 'grow' this value is not used.
  • maxIdle controls the maximum number of objects that can sit idle in the pool at any time. When negative, there is no limit to the number of objects that may be idle at one time.
  • whenExhaustedAction specifies the behavior when the pool is exhausted:
    • When whenExhaustedAction is 'fail', pool will throw an Exception.
    • When whenExhaustedAction is 'grow', pool will create a new object and return it, essentially making maxActive meaningless.
    • When whenExhaustedAction is 'block', pool will block.  If a positive maxWait value is supplied, the pool will block for at most that many milliseconds, after which an Exception will be thrown. If maxWait is non-positive, the server method will block indefinitely. You should always set a positive maxWait value if you use 'block'.
  • When testOnBorrow is set, the pool will attempt to validate each object before it is returned from the pool. Objects that fail to validate will be dropped from the pool, and a different object will be borrowed.
  • When testOnReturn is set, the pool will attempt to validate each object before it is returned to the pool. Objects that fail to validate will be dropped from the pool.
    Optionally, one may configure the pool to examine and possibly evict objects as they sit idle in the pool. This is performed by an "idle object eviction" thread, which runs asychronously. The idle object eviction thread may be configured using the following attributes:
  • timeBetweenEvictionRunsMillis indicates how long the eviction thread should sleep before "runs" of examining idle objects. When non-positive, no eviction thread will be launched.
  • minEvictableIdleTimeMillis specifies the minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due to idle time. When non-positive, no object will be dropped from the pool due to idle time alone.
  • testWhileIdle indicates whether or not idle objects should be validated. Objects that fail to validate will be dropped from the pool.
  • maxAgeMillis is only available for ArcGIS map engine pools and specifies how log Weave should keep and connection to the server open for, it should be less than the "The maximum time a client can use a service" setting in ArcGIS Server.

Namespace

urn:com.cohga.server.pool#1.0

Tags

pool

Properties

Name

Type

Required

Default

Description

maxActive

number

no

8

The maximum number of objects that can be borrowed from the pool at one time. The cap on the total number of active instances from my pool. Use a negative value for an infinite number of instances.

maxIdle

number

no

8

The maximum number of idle connections in the pool. The cap on the number of "idle" instances in the pool. Use a negative value to indicate an unlimited number of idle instances.

maxWait

number

no

1000

The maximum amount of time to wait, in milliseconds, for an object when the pool is exhausted an and whenExhaustedAction is 'block' (otherwise ignored).

minEvictableIdleTimeMillis

number

no

1800000

The minimum number of milliseconds an connection can sit idle in the pool before it is eligible for eviction. Sets the minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any). When non-positive, no objects will be evicted from the pool due to idle time alone.

minIdle

number

no

0

The minimum number of idle connections in the pool. Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects. (Note no objects are created when: numActive + numIdle >= maxActive).

numTestsPerEvictionRun

number

no

3

The number of idle objects to examine per run within the idle object eviction thread (if any). Sets the max number of objects to examine during each run of the idle object evictor thread (if any). When a negative value is supplied, ceil(numIdle)/abs(numTestsPerEvictionRun) tests will be run. I.e., when the value is -n, roughly one nth of the idle objects will be tested per run.

softMinEvictableIdleTimeMillis

number

no

-1

The minimum number of milliseconds an connection can sit idle in the pool before it is eligible for eviction with the extra condition that at least "minIdle" amount of connections remain in the pool. Sets the minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any), with the extra condition that at least "minIdle" amount of object remain in the pool. When non-positive, no objects will be evicted from the pool due to idle time alone.

testOnBorrow

boolean

no

false

Should the connection be checked for validity when being borrowed from the pool. When true, objects will be validated before being returned to the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.

testOnReturn

boolean

no

false

Should the connection be checked for validity when being returned to the pool. When true, objects will be validated before being returned to the pool.

testWhileIdle

boolean

no

false

Should the connection be checked for validity when just sitting in the pool. When true, objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.

timeBetweenEvictionRunsMillis

number

no

-1

Sets the number of milliseconds to sleep between runs of the idle connection evictor. Sets the number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.

whenExhaustedAction

'fail', 'grow' or 'block'

no

block

Sets the action to take when the pool is exhausted (the maximum number of "active" objects has been reached)

Sub-tags

None

Content

None

Examples

<pool:pool>
    <minIdle>4</minIdle>
    <maxIdle>8</maxIdle>
    <testOnBorrow>true</testOnBorrow>
    <testOnReturn>false</testOnReturn>
    <testWhileIdle>true</testWhileIdle>
    <timeBetweenEvictionRunsMillis>60000</timeBetweenEvictionRunsMillis>
    <minEvictableIdleTimeMillis>300000</minEvictableIdleTimeMillis>
    <whenExhaustedAction>grow</whenExhaustedAction>
</pool:pool>
  • No labels