Network Deployment (Distributed operating systems), v8.0 > Applications > Dynamic caching > Dynamic cache service eviction policies
Disk cache infrastructure enhancements
Overview
The dynamic cache service supports persisting objects to disk so that objects that are evicted from the memory cache are not regenerated by the application server. Objects are written to disk when they are evicted from memory using a Least Recently Used (LRU) eviction algorithm. The objects in the memory cache may also be flushed to disk on normal server shutdown. Java objects that need to be offloaded to the disk should be serializable.
The disk offload function includes the following functions:
- An internal disk cache format for faster deletions and support for new options to limit disk cache size
- The disk cache garbage collector, which evicts objects out of the cache when a configured high threshold is reached
- Four new performance modes to tune your disk cache performance:
Memory usage mode Description High performance keeps all metadata in system memory and provides the highest performance Balanced performance provides optimal balance of performance and memory usage by keeping some metadata in system memory Custom performance allows explicit configuration of the memory usage and customization of performance requirements Low performance stores most of the metadata on disk for users who are very constrained on system memory
Limiting the disk cache
The dynamic cache service provides mechanisms to limit the use of the disk cache by specifying...
- size of the disk cache in gigabytes
- maximum number of entries persisted to disk
The disk cache is considered full when either of these limits is reached and forms the basis for eviction of objects from the disk. If the cache subsystem cannot offload any more data to disk, due to either an out-of-disk space condition, insufficient space on disk, or an exception when writing data to disk as a result of a possibly corrupt disk, the disk offload capability is disabled to prevent data integrity problems. The event is logged and the disk cache subsystem is deleted. This prevents serving corrupt data from the cache on a restart. If the option to persist cache data is turned on, some information such as dependency and template information is flushed to disk on a server shutdown. If a disk full situation occurs during this shutdown process, any partially-persisted and un-persisted dependency or template data is removed from the cache. A side effect of this, to preserve integrity, is to invalidate the cached objects that are associated with the dependency or template data.
Disk cache size in GB
The disk cache size in GB option pertains primarily to the object data (which includes the cached object, its identifier, and metadata such as expiration time), template information and dependency information that are written to disk. The cache subsystem allocates separate storage and volumes (each of which can grow to 1 GB) for object data, templates and dependencies, as needed. When the total number of volumes on disk exceeds the specified cache size, any subsequent data written to disk is discarded until more space is made available by the disk cache garbage collector. To preserve data integrity, any information related to discarded objects is invalidated as well. The thresholds for garbage collection (described below) and the disk cache full state are associated with the space available for object data. It is also possible that in certain, rare scenarios, as information is flushed to disk, critical system data needs to be written to disk, which may cause the total file system space required to exceed up to 5% of the specified maximum limit.
IBM recommends that there be at least 25% of actual file system space available for disk caching over and above the specified disk cache size in GB. It is also required that each cache instance has a unique disk offload location and IBM recommends that each offload location be on a dedicated disk partition. The cache file system employs a logical file manager to manage storage allocation for cached objects, therefore the file system size or the size of the files in the cache directory may not be an accurate gauge of the available space for the cache subsystem. At the same time, because of the adjusted limit, the cache subsystem may encounter a cache full state prior to the approaching the specified maximum limit as measured in allocated file system space. The PMI counters provide a better picture of how full the cache is.
Disable the creation of ExtensionRegistry cache files
Whenever a servant restarts, a new ExtensionRegistry cache file is created in the dynacache directory. These files keep accumulating because they are never deleted. If you do not need the data collected in these cache files, you can add the disable.dynacache.offload property to the extension registry properties file, and set the value of this property to true. Setting this property to true disables the creation of ExtensionRegistry cache files for that server. The extension registry properties file is located at the server configuration level under each profile:
profile_home/config/cells/cell_name/nodes/node/servers/server/extensionregistry.properties
Eviction policies using the disk cache garbage collector
Dynamic cache PMI counter definitions
Dynamic cache MBean statistics