Enable WebSphere Commerce data cache
Data that is cached by the WebSphere Commerce data cache can be configured by using either the command caching or DistributedMap objects configuration methods. For the best performance, use DistributedMap object cache configuration. Command caching configuration is provided for compatibility with earlier versions only.If you use command caching, we can choose which data to cache. We can fine-tune the configuration by changing the <cache-entry> element attributes, such as <priority>, <timeout>, and <inactivity>. See
cachespec.xml.The WebSphere Commerce data cache can be configured to use DistributedMap object caches, by defining specially named object caches in the cacheinstances.properties file.
Some DistributedMap object caches are defined automatically during installation. To view these object caches, open the WebSphere Application Server Integrated Solutions Console, and on the left menu, click Resources > Cache instances > Object cache instances.
Procedure
- Command caching
- Open the sample cache configuration file cachespec.xml in the following directory:
- WCDE_installdir\samples\dynacache\
- Copy <cache-entry> elements from the sample cache configuration file to the cachespec.xml file found in the following directory:
- workspace_dir\Stores\WebContent\WEB-INF\
If we already have cache entry tags that are defined in your Stores cachespec.xml file, we might need to measure throughput, CPU usage, and memory usage, and adjust priority, timeout, and inactivity tags to obtain the best performance.
- Object caching in specified DistributedMap instances causes each type of data to be cached in its corresponding DistributedMap object. When we use this method, the cachespec.xml configurations are not used for the kinds of data that has a corresponding DistributedMap defined. We cannot fine-tune the priority, timeout, or inactivity settings using the cachespec.xml configuration file. However, we can specify other DistributedMap attributes, such as the maximum number of cache entries to be used by each DistributedMap. For more information about the cacheinstances.properties file format, see Use the DistributedMap and DistributedObjectCache interfaces for the dynamic cache.
There are two ways we can define DistributedMap objects:
- Define DistributedMap objects with the default JNDI names in the cacheinstances.properties file in the following directory:
- WCDE_installdir\samples\dynacache\
We can copy and paste selected contents of the samples\dynacache\cacheinstances.properties file into our custom cacheinstances.properties file in the Stores.war\WEB-INF\classes directory.
- Use the WebSphere Application Server Integrated Solutions Console. From the left menu, click Resources > Cache instances > Object cache instances.
In a clustered environment, make sure that a replication domain is defined, and at least the services/cache/WCSessionDistributedMapCache object cache is defined. All object caches must enable cache replication (notShared replicationType 1) to allow invalidation IDs to be sent to all nodes in the replication domain. Otherwise, invalidation IDs are not sent to all nodes in the replication domain, resulting in incorrect results due to stale data in some cache instances. Make sure to specify the replication domain and a valid replication type. The "not shared" replication type is recommended.
- Object cache instances that are defined in the cacheinstances.properties files set the corresponding properties for each cache instance.
Property Name Value cache.instance.n.cacheSize Start with the size in the sample cacheinstances.properties file cache.instance.n.enableDiskOffload Start with false. Measure the performance effect before you change this setting. Specify true for cache instances that contain long lived data applicable to many shoppers. However, for both performance and privacy concerns, do not offload user data to the disk. cache.instance.n.flushToDiskOnStop Start with false cache.instance.n.disableDependencyId false cache.instance.n.useListenerContext false cache.instance.n.enableCacheReplication specify true if a replication domain is defined cache.instance.n.replicationType 1 cache.instance.n.replicationDomain your replication domain name cache.instance.n.filterLRUInvalidation true cache.instance.n.filterTimeOutInvalidation true cache.instance.n.filterInactivityInvalidation true cache.instance.n.disableTemplatesSupport true cache.instance.n.ignoreValueInInvalidationEvent true cache.instance.n.useServerClassLoader true
- Configure an object cache to use the WebSphere eXtreme Scale service provider. Object cache instances that are defined in the cacheinstances.properties files set the corresponding properties for each cache instance.
Property Name Value cache.instance.n.cacheSize Start with the size in the sample cacheinstances.properties file cache.instance.n.enableDiskOffload false cache.instance.n.flushToDiskOnStop false cache.instance.n.disableDependencyId false cache.instance.n.useListenerContext false cache.instance.n.enableCacheReplication true cache.instance.n.replicationType 1 cache.instance.n.filterLRUInvalidation true cache.instance.n.filterTimeOutInvalidation true cache.instance.n.filterInactivityInvalidation true cache.instance.n.disableTemplatesSupport true cache.instance.n.ignoreValueInInvalidationEvent true cache.instance.n.useServerClassLoader true cache.instance.n.cacheProviderName com.ibm.ws.objectgrid.dynacache.CacheProviderImpl cache.instance.n.com.ibm.websphere.xs.dynacache.topology remote
Note:
- The custom property cache.instance.n.com.ibm.websphere.xs.dynacache.topology is only required for eXtreme Scale below version 8.6.
- Use WebSphere eXtreme Scale 8.6, the custom property cache.instance.n.com.ibm.websphere.xs.dynacache.disable_recursive_invalidate must not be used. If you use this custom property, excessive amounts of warning messages are logged to the SystemOut.log log file. For more information about this issue, see APAR #.
- The default cache monitor cannot view the contents of the object cache instances. To view the content of an object cache instance, install IBM Extended Cache Monitor for IBM WebSphere Application Server. For more information about this monitor, or to download it, see IBM developerWorks documentation:
Related concepts
Additional WebSphere Commerce data cache configuration
Related reference
Logical cache names and the DistributedMaps they use by default
Access bean classes extended to take advantage of WebSphere Commerce data cache
Data bean classes extended to take advantage of WebSphere Commerce data cache
Promotion evaluation considerations
CalculationCodeListDataBean considerations