z/TPFDF cache support
z/TPFDF cache support provides a mechanism to store z/TPFDF subfiles in the memory cache of the local processor. By using this support, z/TPFDF subfiles can be retrieved without any DASD I/O or virtual file access (VFA) I/O.
Before you can use z/TPFDF cache support, ensure that the z/TPFDF control format-2 global record (IDFCNTRL) is defined and initialized on the z/TPF system. For more information, see Setting up the z/TPFDF control format-2 global record (IDFCNTRL).
z/TPFDF cache support and logical record cache support
z/TPFDF cache support uses logical record cache support to manage the cache and therefore has the characteristics and restrictions of logical record cache support. The name of the cache that z/TPFDF cache support creates is ITPFDFFILES. You can use the ZCACH DISPLAY command to get the information about that cache.
In a loosely coupled z/TPF system with locking, ensure that one or more coupling facilities are defined and available to the z/TPF system for the logical record cache to use.
Read-dominant files
- Read-only files
- Lookup tables that are updated monthly, weekly, or daily
- Data that is updated every few minutes but is still read many times per second
To determine which files have a higher read rate than
write rate, use the CDC data that is reported by runtime metrics collection.
Partially cached subfiles
For a file that is enabled to use z/TPFDF cache support, each of its subfiles can be fully cached or partially cached.
To enable a z/TPFDF file to use z/TPFDF cache support, that file must be defined with a block limit, which determines the maximum number of blocks to be cached for each subfile in that z/TPFDF file. You can use the block limit to control whether to partially cache each subfile or cache each subfile as a whole. For example, if a subfile contains 15 blocks, and you specify the block limit as 10, the first 10 blocks of the subfile are cached, including the prime block and nine overflow blocks. If a subfile read request requires access beyond the first 10 blocks, any additional overflow blocks of the subfile are read from the DASD as needed. You can specify the LIMIT parameter on the ZUDFM CACHE command to define the block limit. The CACHE_PRTL_IOCNT and CACHE_PRTL_IOREQ counters, which are available in CDC data reported by runtime metrics collection, provide information about partially cached subfiles. Based on this information, you can tune your system settings to use z/TPFDF cache support more efficiently.
z/TPFDF subfile read process
- If the subfile is opened with the HOLD parameter specified on the DBOPN macro or with the DFOPN_HOLD value specified on the dfopn function, subsequent z/TPFDF APIs read the subfile from the DASD.
- If the subfile is opened with the
NOHOLD parameter specified on the DBOPN macro or with the
DFOPN_NOHOLD value specified on the dfopn function, detac mode is turned on for the subfile, and the subfile is read in one of the following ways:
- If the cache entry for the subfile exists, the subfile is read from the cache. When the subfile is read from the cache, the subfile is set up as detached blocks in the SW00SR slot.
- If the cache entry for the subfile does not exist, the subfile is read from DASD, and an asynchronous process is started to write the subfile into the cache. After the subfile is written into the cache, subsequent read processing retrieves the subfile from the cache.
- In other cases, for example, when the cache is not defined or the subfile update is in progress, the subfile is read from DASD.
z/TPFDF subfile write process
If z/TPFDF cache support is active and enabled for a z/TPFDF file, each of its subfiles is updated in the following way:
- During z/TPFDF subfile write processing, or when the subfile is released with the RELFC parameter specified on the DBCLS macro or with the DFCLS_RELFC value specified on the dfcls function, the outdated cache entry for the subfile is deleted from the cache.
- In the next read process, because the cache entry for the subfile is not found, the subfile is read from DASD, and an asynchronous process is started to write the subfile into the cache. After the subfile is written into the cache, subsequent read processing retrieves the subfile from the cache.
Restrictions
z/TPF APIs, commands, or processes do not support the z/TPFDF cache. After z/TPFDF cache support is enabled for a z/TPFDF file, you can update the file only by using z/TPFDF APIs and commands. If you use z/TPF APIs, commands, or processes to update that z/TPFDF file, the update is not written into the z/TPFDF cache, and subsequent z/TPFDF APIs might read old data from the z/TPFDF cache. Therefore, before you use z/TPF APIs, commands, or processes to update a z/TPFDF file, you must disable z/TPFDF cache support for the file.