DB2 Version 10.1 for Linux, UNIX, and Windows

DB2 pureScale CF memory parameter configuration

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 CF.

Parameters

The following configuration parameters and registry variables influence the CF memory allocation and management. These parameters and variables only come into effect after a member start or restart, except where noted in the description.
  • cf_mem_sz: controls the total memory used by the CF. The default setting is AUTOMATIC.
  • cf_db_mem_sz: controls the total memory limit used by the CF for this particular database. The default setting is AUTOMATIC.
  • cf_gbp_sz: determines the memory used by the CF for group buffer pool usage, for this particular database. The default setting is AUTOMATIC.
  • cf_lock_sz: determines the memory used by the CF for locking usage, for this particular database. The default setting is AUTOMATIC.
  • cf_sca_sz: determines the memory used by the CF for the Shared Communication Area (SCA) for this particular database. The default setting is AUTOMATIC.
  • numdb: specifies the number of local databases that can be concurrently active. The default number of active databases is 32. This parameter comes into effect only after a group restart.
  • DB2_DATABASE_CF_MEMORY: this registry variable determines the percentage of the total CF memory assigned to each database where the cf_db_mem_sz value is set to AUTOMATIC. The default percentage is 100. This variable comes into effect only after a group restart.
When set to AUTOMATIC, the values of CF memory configuration parameters are dynamically generated based on the properties and attributes of the DB2 pureScale environment.

Parameter relationships

Note: Set the value of numdb higher than or equal to the total number of databases on the instance. This value includes active and inactive databases. Additionally, you can set the value of DB2_DATABASE_CF_MEMORY to a value so that every database on this instance, whether normally inactive or active, can be active at the same time.
The cluster caching facility memory parameters are defined at both an instance level and a database level:
  • At the instance level, the total amount of memory reserved for the CF is determined by the cf_mem_sz configuration parameter.
  • At the database level, the total amount of memory used by all the CF structures for a database is controlled by the cf_db_mem_sz configuration parameter.
The memory limit defined by the database-level cf_db_mem_sz parameter is constrained by the instance-level cf_mem_sz parameter. An upper limit is therefore placed on the cf_db_mem_sz parameter: it cannot exceed this memory threshold to accommodate the memory requirements for the CF database structures. The total sum value of the cf_db_mem_sz parameters for all active databases cannot exceed the value of cf_mem_sz for the instance.

Similarly, although the cf_db_mem_sz parameter controls the total amount of memory that can be used by all the CF structures for a database, at no time can the database manager reserve a block of memory equal to the value of cf_db_mem_sz.

The configuration parameters that control the amount of memory for each of the CF structures for a database are:
  • cf_gbp_sz
  • cf_lock_sz
  • cf_sca_sz
The CF uses 3840 4k pages internally; these pages are taken from amount specified by the cf_mem_sz parameter. Additionally, there are 256 4k pages reserved from cf_mem_sz for every active database on the instance. These additional amounts are only included when the cf_mem_sz parameter is set manually.

Automatic configurations

The default setting for the cf_mem_sz parameter is AUTOMATIC. This means that the amount of memory available for use by the CF is calculated using the total memory available on the CF host. The parameter is dynamically set to either:
  • An appropriate percentage, typically 70% to 90%, of the total memory available on the CF host.
  • The amount of free memory on the CF host.
whichever value is lower.

The default setting for the cf_db_mem_sz parameter is AUTOMATIC. The actual value is determined based on the DB2_DATABASE_CF_MEMORY, cf_mem_sz, and numdb parameter values in effect when the database is first activated on any member.

Another factor considered during AUTOMATIC computation is if the CF and any DB2 members coexist.

Online configurations

The cf_mem_sz parameter is not configurable online. The CF server must be restarted in order for a new value of cf_mem_sz to take effect.

The cf_db_mem_sz parameter is configurable online, however there are several constraints to note:
  • The value of cf_db_mem_sz must always be less than the current value of cf_mem_sz. If you want to increase cf_db_mem_sz to a value greater than the current value of cf_mem_sz, you must first increase the value of cf_mem_sz.
  • Even if the cf_db_mem_sz parameter is increased to a value that is less than the cf_mem_sz parameter, the following situations cause an error:
    • Requesting an online increase for a CF structure memory parameter, where the sum of the CF structure memory parameters does not exceed the value of cf_db_mem_sz, but does exceed the upper threshold limit set by the cf_mem_sz parameter. There is not enough available memory in the CF to satisfy the CF structure memory request, and an error is generated.
  • The value of cf_db_mem_sz must always be greater than the sum of the cf_gbp_sz, cf_lock_sz, and cf_sca_sz parameters. If the value of cf_db_mem_sz is reduced, the values of those three CF structure parameters must also be reduced to accommodate the changed memory limit set by the cf_db_mem_sz parameter. Failure to do so results in an error because there is insufficient memory provided by the cf_db_mem_sz parameter.
The cf_gbp_sz, cf_lock_sz, and cf_sca_sz parameters are configurable online, however there are several constraints to note:
  • Any attempt to change these parameters can result in a timeout error if the system is busy or there is not enough available CF memory at the time the request was submitted.
    Note: Although memory might not be available at the time the request is submitted, the system continues to attempt the update in case sufficient memory becomes available to satisfy the request. The update operation waits for the processing to be completed.
  • During the update operation of a CF structure memory parameter, if a second request to update the same structure memory parameter is initiated, an error is triggered.

Multiple active databases

In a DB2 pureScale environment running multiple active databases, there are additional considerations when planning the memory configuration requirements for each active database. The key configuration parameter in this situation is DB2_DATABASE_CF_MEMORY. This parameter is used with the other CF configuration parameters, to indicate the percentage of the total CF memory that is allocated to each database. The DB2_DATABASE_CF_MEMORY parameter is expressed as a float data type, and if it has:
A value of -1
The dynamically generated value of the cf_db_mem_sz parameter for each active database is equal to the result of this calculation: cf_mem_sz divided by numdb:
               cf_mem_sz
cf_db_mem_sz = ---------
                 numdb
This means that every database that is active receives an equal share of memory from the cf_mem_sz, if that database has the cf_db_mem_sz parameter set to AUTOMATIC.
Note: If the calculated value of cf_db_mem_sz is smaller than the minimum value of the cf_db_mem_sz parameter, the cf_db_mem_sz value is automatically set to the minimum allowed value of cf_db_mem_sz.
A value of 0
Every database in the DB2 pureScale environment must have the cf_db_mem_sz value set manually. Otherwise, if the value of cf_db_mem_sz is set to AUTOMATIC, then that database receives the minimum allowed value of 32,768.
A value between 0 and 100
The value of the cf_db_mem_sz parameter is equal to the result of this calculation:
                           db2_database_cf_memory
cf_db_mem_sz = cf_mem_sz * ----------------------
                                     100
Note: If the calculated value of cf_db_mem_sz is smaller than the minimum value of the cf_db_mem_sz parameter, the cf_db_mem_sz value is automatically set to the minimum allowed value of cf_db_mem_sz.
A value of 100
Only one database is able to activate in the DB2 pureScale environment, and it receives all of the CF memory defined by the cf_mem_sz parameter.
In configurations where DB2_DATABASE_CF_MEMORY is used to dynamically calculate the value for the cf_db_mem_sz parameter, the value of cf_db_mem_sz can never be smaller than its minimum allowed value, regardless of the setting of the DB2_DATABASE_CF_MEMORY parameter.

Restrictions

Self-tuning of CF memory between databases is not supported.

Examples

Example 1: In this example, the DB2_DATABASE_CF_MEMORY registry variable is not changed from the default setting of "100". Therefore, only one database receives all of the CF memory (an amount equal to the value defined by the cf_mem_sz parameter. If a second database is created or started, the command fails with an out of memory error. To avoid this situation, so that a second database can be created with equal memory sharing, the CF memory parameters must be modified (this assumes that cf_db_mem_sz is set to AUTOMATIC):
db2stop
db2 update dbm cfg using numdb 2
db2set db2_database_cf_memory=50
db2 start
Example 2: In this example, the DB2_DATABASE_CF_MEMORY registry variable is changed to give all databases an equal share of the CF memory, based on having two active databases:
db2stop
db2 update dbm cfg using numdb 2
db2set db2_database_cf_memory=-1
db2 start
db2 connect to INVOICES      # success
db2 connect to HRDEPT        # success
Example 3: In this example, the DB2_DATABASE_CF_MEMORY registry variable is changed to give all 200 databases an equal share of the CF memory, based on having 200 active databases:
db2stop
db2 update dbm cfg using numdb 200
db2set db2_database_cf_memory=0.5
db2 start