Resource Pooling

 

On most systems, the usage pattern of some resources (database connections, network connections, CPU threads) may have a direct impact on performance. In JMap Server, these resources are used very efficiently through a principle called pooling. Pooling is described as follows:

1.A certain number of resource instances are created, initialized at startup and placed in a pool (ex: 3 database connections);

2.When an instance of a resource is needed by the system, the resource is borrowed from the pool and becomes locked (made unavailable) for others;

3.Work is done using the resource (e.g. executing SQL queries);

4.The resource is returned to the pool and is unlocked (made available) for others.

This mechanism is efficient because the resources are shared between different parts of the system, thus reducing their number. Also, initialization only occurs at startup, improving the system's performance (establishing a database connection is time consuming).

In JMap Server, if a pool becomes out of resources (all locked), new resources are initialized automatically (the pool grows) but performance may be impacted. If the demand decreases, the pool will regain its initial size after a certain period of time. This means that choosing an appropriate initial size for each pool is important. You can also specify a maximum size for a pool. When a pool reaches its maximum size, further requests are queued until a pooled resource becomes available again. To help you, some statistics are displayed in JMap Admin about pool usage: current size and peak size.

For database connection pools, an inactivity timeout is needed to automate the closing and reopening of inactive connections, which avoids having the connections terminated by database management systems after a given period of inactivity.