|Powered by QM on a Rpi server|
KnowledgeBase 00089: Record Caching
This article was originally published as a Tip of the Week.
Some applications repeatedly read the same record many times, perhaps as a look-up table related to processing of other records. Although the data file group is likely to be cached in memory by the operating system, further performance improvement may be possible by caching at the record level.
The RECCACHE Configuration Parameter
The RECCACHE configuration parameter, modifiable on a per-process basis using the CONFIG command, determines the size of the record cache maintained by QM. The default is zero (disabled) and the maximum value is 32 records.
A record will be placed in the record cache when it is read, displacing the oldest record in the cache if the size limit has been reached. Subsequent reads for the same record will find the cached copy without needing to access the group buffer or perform a physical disk read.
The cache entry for a record will be invalidated when a write or delete operation occurs in the file, regardless of whether this is for a different record. The performance gain from caching may therefore not be as great as could be achieved with invalidation only when the cached record is updated but the complexity of a cross-process id sensitive invalidation mechanism probably outweighs its benefits.
To Cache Or Not To Cache?
Enabling record caching in a system that does not repeatedly read the same records will give no benefits but will introduce a very small additional performance cost for the additional cache searching. Developers and administrators should examine the way in which the application works when considering use of record caching.