Dynamic cache service settings
Configure and manage the dynamic cache service settings.
Servers > Server Types > WebSphere application servers > server > Container services > Dynamic cache service
Settings
Enable service at server startup
The dynamic servlet cache service starts when the server starts. This option displays on WebSphere Application Server V6.1 servers but is not available on WAS V7.0 servers.
Enable servlet caching
The dynamic servlet cache service starts when servlet caching is enabled in Web Container panel.
Enable portlet caching
Start the dynamic portlet cache service by enabling servlet caching, then, enabling portlet fragment caching under Portlet Container panel.
Cache provider
Configure the server to use the default dynamic cache provider or an alternate cache provider. If an alternate cache provider is available, it appears in the list of available cache providers. If WebSphere eXtreme Scale is available as an alternate cache provider, see the topics " Introduction: Dynamic cache," and "Configure dynamic cache (DynaCache) to use the WebSphere eXtreme Scale dynamic cache provider" for more information about setting up and using WebSphere eXtreme Scale with WAS.
Cache size
Positive integer as the value for the maximum number of entries that the cache holds. Enter a cache size value in this field that is between the range of 100 through 200,000.
Default priority
Default priority for cache entries, determining how long an entry stays in a full cache. Default: 1 Range: 1 to 255
Limit memory cache size
Constrain the cache in terms of the JVM heap. In addition to specifying the cache size in megabytes (MB), the dynamic cache also enables us to set a high watermark and a low watermark for the cache heap that is consumed. When the cache heap memory reaches the high watermark, and if the disk offload feature is enabled, the dynamic cache either discards cache entries from memory or evicts entries to the disk using the least recently used (LRU) algorithm until the cache reaches the low watermark. This functionality of limiting the cache in terms of the JVM heap is only available if the objects that are put into the cache implement the sizable interface. This interface has one method that returns the size of the object in bytes put into the cache. The dynamic cache uses the sizable interface to estimate the heap size of the cache.
Information Value Default -1 to disable limiting the memory cache size Range 1 to maximum integer Memory cache size
Maximum memory cache size in MB.
High threshold
Specifies a high watermark when the memory cache eviction policy starts. The threshold is expressed in terms of the percentage of the memory cache size in MB. The default is 95%
Information Value Values 1 to 100 Low threshold
Low watermark when the memory cache eviction policy ends. The threshold is expressed in terms of the percentage of the memory cache size in MB. The default is 80%.
Information Value Values 1 to 100 Enable disk offload
Specifies whether disk offload is enabled.
By default, the dynamic cache maintains the number of entries configured in memory. If new entries are created while the cache is full, the priorities configured for each cache entry, and a least recently used algorithm, are used to remove entries from the cache. In addition to having a cache entry removed from memory when the cache is full, we can enable disk offload to have a cache entry copied to the file system (the location is configurable). Later, if that cache entry is needed, it is moved back to memory from the file system.
Before enabling disk offload, consider the following:
- We cannot specify the number of cache entries that are offloaded to disk.
- We cannot specify the amount of disk space to use.
Offload location
Location on the disk to save cache entries when disk offload is enabled.
If disk offload location is not specified, the default location is...
${WAS_TEMP_DIR}/node/server name/_dynacache/cache_JNDI_name
If disk offload location is specified, the node, server name, and cache instance name are appended. For example...
${USER_INSTALL_ROOT}/diskoffload
...generates the location as...
${USER_INSTALL_ROOT}/diskoffload/node/server/cache_JNDI_name
This value is ignored if disk offload is not enabled.
The default value of the ${WAS_TEMP_DIR} property is...
${USER_INSTALL_ROOT}/temp
If we change the value of the ${WAS_TEMP_DIR} property after starting WAS, but do not move the disk cache contents to the new location:
- The application server creates a disk cache file at the new disk offload location.
- If the Flush to disk setting is enabled, all of the disk cache content at the old location is lost when restarting the application server
When we are specifying a directory, consider the following:
- If we expect to cache many objects or large objects that will be around for some time, consider using a separate disk drive if we are using Windows operating systems, or a separate file system if we are using UNIX platforms.
- If we use the default directory and the disk fills up, WAS could possibly stall if it must write messages to log files, and there is no more space.
- (UNIX) If we specify a directory such as /tmp on UNIX platforms and that directory fills up, we might have trouble logging on to the system.
- Depending on the operating system, we might see disk full messages on the console.
Flush to disk
Specifies if in-memory cached objects are saved to disk when the server is stopped. This value is ignored if Enable disk offload is not selected.
Information Value Default false Limit disk cache size in GB
Maximum disk cache size in GB. When selected, we can specify a positive integer value. Leaving this option blank indicates an unlimited size. This setting applies only if enable disk offload is specified for the cache.
Information Value Value 3 and above. Limit disk cache size in entries
Maximum disk cache size in number of entries. When selected, we can specify a positive integer value. Leaving this option blank indicates an unlimited size. This setting applies only if enable disk offload is specified for the cache.
Information Value Value 0 to MAXINT. A value of 0 indicates unlimited size. Limit disk cache entry size
Maximum size of an individual cache entry in MB. Any cache entry larger than this value, when evicted from memory, is not offloaded to disk. When selected, we can specify a positive integer value. Leaving this option blank indicates an unlimited size. This setting applies only if enable disk offload is specified for the cache.
Information Value Value 0 to MAXINT. A value of 0 indicates unlimited size. Disk cache performance settings
Level of performance required by the disk cache. This setting applies only if enableDiskOffload is specified for the cache. Performance levels determine how memory resources should be used on background activity such as cache cleanup, expiration, garbage collection, and so on. This setting applies only if enable disk offload is specified for the cache.
Information Value High performance and high memory usage Indicates that all metadata is kept in memory. Balanced performance and balanced memory usage Indicates some metadata is kept in memory. This is the default performance setting and provides an optimal balance of performance and memory usage for most users. Low performance and low memory usage Indicates that limited metadata is kept in memory. Custom performance Indicates that the administrator explicitly configures the memory settings used to support the above background activity. The administrator sets these values using the DiskCacheCustomPerformanceSettings object. Disk cache cleanup frequency
Disk cache cleanup frequency, in minutes. If this value is set to 0, the cleanup runs only at midnight. This setting applies only when the Disk Offload Performance Level is low, balanced, or custom. The high performance level does not require disk cleanup, and this value is ignored.
Information Value Value 0 to 1440 Maximum buffer for cache identifiers per metaentry
Maximum number of cache identifiers stored for an individual dependency ID or template in the disk cache metadata in memory. If this limit is exceeded the information is offloaded to the disk. This setting applies only when the disk offload performance level is CUSTOM.
Information Value Value 100 to MAXINT Maximum buffer for dependency identifiers
Maximum number of dependency identifier buckets in the disk cache metadata in memory. If this limit is exceeded the information is offloaded to the disk. This setting applies only when the disk cache performance level is custom.
Information Value Value 100 to MAXINT Maximum buffer for templates
Maximum number of template buckets in the disk cache metadata in memory. If this limit is exceeded the information is offloaded to the disk. This setting applies only when the disk cache performance level is custom.
Information Value Value 10 to MAXINT Disk cache eviction algorithm
Eviction algorithm that the disk cache uses to evict entries when the high threshold is reached. This setting applies only if enable disk offload is specified for the cache. This setting does not apply when the disk cache eviction policy is set to none.
Information Value None No eviction policy, so the disk cache can grow until it reaches its limit at which time the dynamic cache service stops writing to disk Random When the disk size reaches a high threshold limit, the disk cache garbage collector wakes up and randomly picks entries on the disk and evicts them until the size reaches a low threshold limit. Size When the disk size reaches a high threshold limit, the disk cache garbage collector wakes up and picks the largest entries on the disk and evicts them until the disk size reaches a low threshold limit. High threshold
Specifies when the eviction policy runs. The threshold is expressed in terms of the percentage of the disk cache size in GB or entries. The lower value is used when limit disk cache size in GB and limit disk cache size in entries are specified. This setting does not apply when the disk cache eviction policy is set to none.
Information Value Values 1 to 100 Low threshold
Specifies when the eviction policy ends. The threshold is expressed in terms of the percentage of the disk cache size in GB or entries. The lower value is used limit disk cache size in GB and limit disk cache size in entries are specified. This setting does not apply when the disk cache eviction policy is set to none.
Information Value Values 1 to 100 Enable cache replication
Use cache replication to have cache entries copied to multiple application servers configured in the same replication domain.
Full group replication domain
Replication domain from which data is replicated.
Choose from any replication domains that have been defined. If there are no replication domains listed, create one during cluster creation or manually in the administrative console by clicking...
Environment > Internal replication domains > New
The replication domain we choose to use with the dynamic cache service must be using a Full group replica. Do not share replication domains between replication consumers. Dynamic cache should use a different replication domain from session manager or stateful session beans.
Replication type
The global sharing policy for this application server.
The following settings are available:
- Both push and pull sends the cache ID of newly updated content to other servers in the replication domain. Then, if one of the other servers requests the content, and that server has the ID of the cache entry for the previously updated content, it retrieves the content from the publishing server. Alternatively, if a request is made for an ID which has not been previously published, the server assumes that it does not exist in the cluster and creates an entry.
- Push only sends the cache ID and cache content of new content to all other servers in the replication domain.
- When we use the Not Shared setting, as cache entries are created, neither the cache content nor the cache IDs are propagated to other servants or servers in the replication domain. However, invalidations are propagated to other servants or servers. We can set the sharing policy at different levels. A global sharing policy, which is the default policy for all caches, is defined when we configure the dynamic cache service. We can overwrite this sharing policy by modifying the cachespeccachespec.xml file. Additionally, we can overwrite the sharing policy at the API level when cache entries are being created.
The default is Not Shared.
When Not Shared is selected, you see none in the cachespec.xml file.
Push frequency
Time, in seconds, to wait before pushing new or modified cache entries to other servers.
If we set this property value to 1 (one) or greater, the application server pushes all cache entries created or modified during the time period to other servers. If we set the property to 0 (zero) or a negative value, the application server converts the property value to the default value, which is 1 (one).
Related:
Introduction: Dynamic cache Task overview: Using the dynamic cache service to improve performance cachespec.xml file WebSphere eXtreme Scale examples Configure dynamic cache (DynaCache) to use the WebSphere eXtreme Scale dynamic cache provider