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
In Db2 10.5.0.5 and later fix packs, when specifically enabled, CF memory can be self-tuned.
- cf_mem_sz: controls the total memory that is used by the CF. The default setting is AUTOMATIC.
- cf_db_mem_sz: controls the total memory limit that is used by the CF for this particular database. The default setting is AUTOMATIC.
- cf_gbp_sz: determines the memory that is used by the CF for group buffer pool usage, for this particular database. The default setting is AUTOMATIC.
- cf_lock_sz: determines the memory that is used by the CF for locking usage, for this particular database. The default setting is AUTOMATIC.
- cf_sca_sz: determines the memory that is 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 that is assigned to each database where the cf_db_mem_sz value is set to AUTOMATIC. This variable comes into effect only after a group restart. (that is, after shutting down the entire Db2 pureScale instance using the db2stop command, and an instance restart using the db2start command).
Parameter relationships
- At the instance level, the total amount of memory that is reserved for the CF is determined by the cf_mem_sz configuration parameter.
- At the database level, the total amount of memory that is used by all the CF structures for a database is controlled by the cf_db_mem_sz configuration parameter.
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.
- cf_gbp_sz
- cf_lock_sz
- cf_sca_sz
Automatic configurations
- 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.
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.
When CF_DB_MEM_SZ is set to AUTOMATIC, the CF memory consumer parameters (CF_GBP_SZ, CF_LOCK_SZ and CF_SCA_SZ) are automatically set to AUTOMATIC.
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 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,
these 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.
- 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
- 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:
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.cf_mem_sz cf_db_mem_sz = --------- numdb
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.
Examples
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
db2start
db2stop
db2 update dbm cfg using numdb 2
db2set db2_database_cf_memory=-1
db2start
db2 connect to INVOICES # success
db2 connect to HRDEPT # success
db2stop
db2 update dbm cfg using numdb 200
db2set db2_database_cf_memory=0.5
db2start
db2stop
db2 update dbm cfg using numdb 2
db2set db2_database_cf_memory=AUTO
db2start