Limiting Cache Agent Connections to the Oracle Database

Cache starts a set number of connections to the Oracle Database for each cache agent for cache management. If you have a large grid, then you may want to manage the number of required cache agent connections.

Every cache agent in TimesTen Scaleout starts 11 active cache management threads with connections to the Oracle database. In addition, 2 more connections are added for each autorefresh interval for each cache agent. For example, if you have cache groups defined with 4 different autorefresh intervals, then (2*4)=8 additional connections for each cache agent to manage autorefresh intervals are created to the Oracle database. Thus, the total number of connections created to the Oracle database when using cache in TimesTen Scaleout is:

total_number_connections = num_cache_agents * (11 + (2 * num_interval))

The following example uses a grid where:

  • k=3.

  • A database in that grid is defined with 10 replica sets.

  • The user specifies cache groups with four autorefresh intervals.

In this example, you would create 30 hosts, which are labeled host01, host02, … host30. If each data instance on these hosts in this example runs a cache agent, then the number of connections to the Oracle database for servicing the cache agents would be:

30 * (11 + (2*4)) = 570

If you have a large grid with one cache agent started for each instance, this creates a scenario where there can be redundant open cache management connections to the Oracle database. Instead, we recommend that for a large grid, you start only a fraction of the cache agents. The minimum number of cache agents that you can start is one cache agent for each autorefresh interval plus one cache agent for each k-factor.

num_cache_agents = (num_interval + k) 

Thus, in our previous example where there are 4 autorefresh intervals with a k-factor of 3, then you would start (4+3)=7 cache agents using the ttGridAdmin dbCacheStart -instance command.

Each cache agent has threads connected to the Oracle database to perform cache management tasks, as well as refresher threads performing autorefresh operations. The autorefresh intervals are rebalanced among active cache agents so that each cache agent autorefreshes the mean interval for each cache agent.

In our example, we would start 7 cache agents.

% ttGridAdmin dbCacheStart -instance host01 database1
Database database1 : Starting cache agents. 
% ttGridAdmin dbCacheStart -instance host02 database1
Database database1 : Starting cache agents. 
% ttGridAdmin dbCacheStart -instance host03 database1
Database database1 : Starting cache agents.
% ttGridAdmin dbCacheStart -instance host04 database1
Database database1 : Starting cache agents. 
% ttGridAdmin dbCacheStart -instance host05 database1
Database database1 : Starting cache agents. 
% ttGridAdmin dbCacheStart -instance host06 database1
Database database1 : Starting cache agents. 
% ttGridAdmin dbCacheStart -instance host07 database1
Database database1 : Starting cache agents. 

With seven cache agents started, each servicing 4 autorefresh intervals, there are (7 * (11 + (2*4))= 133 connections to the Oracle database just for cache management. Autorefresh operations and cache management tasks are load balanced over seven data instances. Depending on availability requirements, users can choose to limit the number of connections further by reducing the number of autorefresh intervals required in the cache groups.

Since cache agents are known to be on the first seven data instances, all manual cache operations that require a cache agent must be executed on one of these seven data instances. If you need to run a manual cache operation from a data instance that does not have a cache agent running, you can perform the following:

  1. On the active management instance, start the cache agent for the data instance where you want to perform the cache operation (for example host19) by executing the ttGridAdmin dbCacheStart command.

    % ttGridAdmin dbCacheStart -instance host19 database1
    Database database1 : Starting cache agents. 
  2. Execute the cache operation on the data instance on host19.

  3. Once the manual cache operation is completed, stop the cache agent for that data instance by executing the ttGridAdmin dbCacheStop command on the active management instance.

    % ttGridAdmin dbCacheStop -instance host19 database1
    Database database1 : Stopping cache agents.