In a DB2® pureScale® instance, several configuration parameters and registry variables work together to control memory allocation for the cluster caching facility, also known as the CF.
In DB2 Version 10.5 Fix Pack 5 and later fix packs, when explicitly enabled, cluster caching facility (CF) self-tuning memory optimizes memory distribution and avoids out of memory conditions. Unless explicitly enabled, CF memory parameter configuration functions as before.
CF memory is dynamically distributed between these CF memory consumer parameters. In addition, in multiple database environments, CF memory can be dynamically distributed between databases based on their need for memory.
db2set DB2_DATABASE_CF_MEMORY=AUTO
Setting DB2_DATABASE_CF_MEMORY to AUTO turns
on CF self-tuning memory for all databases that have the CF memory
consumer parameters (cf_gbp_sz, cf_lock_sz, cf_sca_sz)
set to AUTOMATIC. However, for databases that have
the CF memory consumer parameters set to fixed values, CF self-tuning
memory remains off. In this case, depending on workload, CF memory is available for use between all databases that also have cf_db_mem_sz set to AUTOMATIC, and database memory within one database.
Database memory is also dynamically distributed between the CF memory consumer parameters (cf_gbp_sz, cf_lock_sz, cf_sca_sz).
In this case, memory is not dynamically distributed between databases, but memory is dynamically distributed between the CF memory consumer parameters (cf_gbp_sz, cf_lock_sz, cf_sca_sz).
If you have more than one database, while it is optimal for all databases to use CF self-tuning memory, it is possible to have only a subset of the databases in the instance use CF self-tuning memory. That is, one or more databases has cf_db_mem_sz set to a fixed value. When using a fixed value, the databases do not need to have the same fixed value. Also, in this case, to avoid the possibility of insufficient free CF memory, the order of database activation is important. Activate the databases with a fixed value first.
Before DB2 Version 10.5 Fix Pack 5, the value of database memory parameter cf_db_mem_sz was static. In DB2 Version 10.5 Fix Pack 5 and later fix packs, when cf_db_mem_sz is set to AUTOMATIC, CF self-tuning memory limits the maximum CF database memory that is based on database manager configuration parameter numdb. Set numdb as close as possible to the expected number of active databases. For example, in the case of a single database environment, the value of numdb determines how much CF memory is used by the single database. If numdb is set to 1, all CF memory is used by the single database. However, if numdb is set to a value greater than 1, a small amount of memory remains unusable for that single database.
In a multiple database environment, CF memory is configured automatically based on workload and available memory. When a new database is activated, databases that are already active automatically give up CF memory for the newly activated database until a workload-based distribution of CF memory is reached.
Changes resulting from the CF self-tuning operations are recorded in memory tuning log files that are in the db2dump/stmmlog directory. The log provides useful diagnostic information, including CF memory consumer parameter sizes.
When cf_db_mem_sz is set to AUTOMATIC, CF self-tuning memory ensures that the database uses a reasonable portion of the CF memory and attempts to activate the database with the parameter values that the CF memory consumer parameters were set to. CF self-tuning memory monitors the memory consumer parameters, determines the new values, and dynamically resizes the affected configuration parameters. Manual intervention is not required. These small but frequent changes are required to satisfy changing CF memory needs. If you have more than one database, in the case of CF memory contention, CF self-tuning memory makes changes towards a workload-based distribution for the active databases.
When cf_db_mem_sz is set to a fixed value, you specify the amount of memory that a database can take from CF memory. CF self-tuning memory works within the CF memory that is limited by this database memory parameter.
Database Configuration for Database
Description Parameter Current Value Delayed Value
------------------------------------------------------------------------------------------------------
...
CF Resource Configuration:
CF self-tuning memory = ON
CF database memory size (4KB) (CF_DB_MEM_SZ) = AUTOMATIC(8383744) AUTOMATIC(8383744)
Group buffer pool size (4KB) (CF_GBP_SZ) = AUTOMATIC(6589696) AUTOMATIC(6589696)
Global lock memory size (4KB) (CF_LOCK_SZ) = AUTOMATIC(1257728) AUTOMATIC(1257728)
Shared communication area size (4KB) (CF_SCA_SZ) = AUTOMATIC(135245) AUTOMATIC(135245)
Smart array size (4KB) (CF_LIST_SZ) = AUTOMATIC(315571) AUTOMATIC(315571)
CF memory consumer parameters (cf_gbp_sz, cf_lock_sz, cf_sca_sz) |
CF database memory parameter cf_db_mem_sz |
CF self-tuning memory (on or off |
---|---|---|
AUTOMATIC | AUTOMATIC | Set to or remains ON for
the database. cf_db_mem_sz and the three memory consumer parameters are tuned. |
AUTOMATIC | Fixed value | Set to or remains ON for
the database. cf_db_mem_sz is not tuned. The three memory consumer parameters are tuned. |
Fixed value | Fixed value | Turned off for the database. There is no CF self-tuning memory for this database. |
When explicitly disabled by changing the registry variable DB2_DATABASE_CF_MEMORY from AUTO to a numeric value, CF memory tuning is turned off for all databases that are activated. However, the CF memory usage by the database and the CF memory consumer parameters is not adjusted immediately for these databases. The current CF memory sizes remain at the current level. A database manager restart is required.
CF self-tuning memory in a multiple database environment with cf_db_mem_sz set to AUTOMATIC
If you are running in an environment with one database with database manager configuration parameter numdb set to 2 (or higher), when CF self-tuning memory is turned on, that database can use almost all CF memory. (Some memory is reserved for additional database activation.) Later when another database is added, after that database is started, the already active database automatically gives up CF memory for the newly activated database until needed, or until a workload-based distribution of CF memory is reached.
In addition, in this case, the databases can dynamically distribute memory that is based on their need for CF memory. This results in moving memory from the database with lower need to the database with higher need. When all databases have equal demand for CF memory, each database has its one third share of CF instance memory.
CF self-tuning memory in a multiple database environment with cf_db_mem_sz set to a fixed value, and memory consumer parameters set to AUTOMATIC
If you are running in an environment with two databases, when CF self-tuning memory is turned on, each database consumes the percentage of CF memory as specified by the fixed values.