Enable the Cache Connection Pool
You can specify that TimesTen creates a cache connection pool on the TimesTen server when it starts up.
If a cache connection pool is created, then a dynamic load request from a client/server connection acquires a connection from the cache connection pool, performs the dynamic load, and returns the connection to the cache connection pool after the dynamic load request completes. The cache connection pool is destroyed when the TimesTen server shuts down.
Note:
The cache connection pool can only be initiated from client-server applications (using multithreaded mode) and is used only for dynamic loads initiated for dynamic read-only cache groups.
To enable client/server connection requests to use the cache connection pool, an application must specify the following connection attributes when connecting.
-
MaxConnsPerServer
connection attribute: This connection attribute sets the maximum number of client/server connections that can be created for each child server process. When the value is set to > 1, each TimesTen child server can handle multiple client connections where each client/server connection is multithreaded. You can only use the cache connection pool with a multithreaded client/server connection.When
MaxConnsPerServer
connection attribute is set to 1, TimesTen creates one single-threaded client/server connection for each child server process. -
ServersPerDSN
connection attribute: Value designates the number of child server processes to spawn for the TimesTen server. Default is 1.Each new incoming connection spawns a new child server process up to the value specified by the
ServersPerDSN
connection attribute. When the maximum number of child server processes is reached, the existing child server processes handle multiple connections (up to the number specified inMaxConnsPerServer
) in a round-robin method. That is, if you specifyServersPerDSN
= 2 andMaxConnsPerServer
= 3, then the first two connections would spawn two child server processes. The third through the sixth connections would be handled by these child server processes, where each child server process would service every other connection.Once all of the child server processes have the maximum allowed number of connections, the next incoming connection starts a new set of child server processes.
The
ServersPerDSN
andMaxConnsPerServer
connection attributes are used to designate how to distribute connections across multiple child server processes. -
UseCacheConnPool
connection attribute: Must be enabled (set to 2) to use the cache connection pool. When theUseCacheConnPool
connection attribute is enabled, the cache connection pool is created and used for dynamic load operations initiated by multithreaded client/server connections. If theUseCacheConnPool
connection attribute is disabled (set to 0), then the cache connection pool is not created and the dynamic load operations perform using the existing behavior. See UseCacheConnPool in the Oracle TimesTen In-Memory Database Reference.
Note:
You may also want to limit the number of connections to the Oracle database. See Limiting the Number of Connections to the Oracle Database.
The following example specifies connection attributes for the cache connection pool in the DSN definition:
The cache1
DSN definition in the sys.odbc.ini
file specifies UseCacheConnPool=2
, ServersPerDSN=2
and MaxConnsPerServer=3
.
[cache1] DataStore=/users/OracleCache/database1 PermSize=64 OracleNetServiceName=oracledb DatabaseCharacterSet=AL32UTF8 UseCacheConnPool=2 ServersPerDSN=2 MaxConnsPerServer=3
Alternatively, you can specify both of the connection attributes on the command line when connecting from the application.
ttIsql "DSN=cache1;OracleNetServiceName=oracledb;UseCacheConnPool=2;ServersPerDSN=2;MaxConnsPerServer=3"
Note:
See the MaxConnsPerServer, ServersPerDSN, and UseCacheConnPool sections in the Oracle TimesTen In-Memory Database Reference.