Enable the dynamic cache service and servlet caching
For local stores running in the Development environment, we can use the WebSphere Application Server administrative console to enable the dynamic cache service and servlet caching. For local stores running in the server/runtime environment, create a custom image using Run Engine commands to enable dynamic cache service and servlet caching. Notes:
- Data caching is enabled by default for remote stores. In the default Store server Docker container, we can find the cache parameters in the server.xml file configuration file. The parameters are defined in <distributedMap id="services/cache/cachename" memorySizeInEntries="cachesize"/> elements, where cachename is the name of the Store server cache, and cachesize is the number of entries to cache.
- For stores that run on the Store server, it might not be necessary to tune performance as the default settings might be sufficient. To tune the performance of the Store server, see the topic
distributedMap - Distributed Map (distributedMap).- In the development environment, servlet caching is disabled. To enable and use servlet caching, see the Configure servlet caching topic.
Procedure
- To ensure that the dynamic cache service is enabled, see the Enable the dynamic cache service topics.
- Configure the baseCache to use the default Dynamic Cache service provider.
- Open the WebSphere Application Server administrative console.
- Expand Servers > Server Type. Click WebSphere Application Servers > your_Commerce_Application_Name.
- In the Container Settings section, expand Container services. Click Dynamic cache service.
- From the Cache provider list, select Default dynamic cache.
- Optional: If more than one server is defined:
- Check Enable cache replication.
- Ensure the replication domain and replication type of all out of box DistributedMap object caches are specified.
- Open the WebSphere Application Server Integrated Solutions Console.
- From the left menu, click Resources > Cache instances > Object cache instances.
- In the Cache size field, specify a cache size. Start with the default setting of 2000.
- In the Memory Cache Size section, ensure that the Limit memory cache size check box is not selected.
- In the Disk Cache settings section, ensure that the Enable disk offload check box is selected.
- To flush the disk when the server is stopped, choose the Flush to disk option. If this option is selected, the existing disk cache is used when the server restarts. Any invalidations that are issued by other servers while the server is down, are not processed. As a result, stale cached data might be used when the server restarts.
- To limit the size of the disk cache, choose from the following options:
- Limit disk cache size in GB
- Specify a value for disk cache size.
- Limit disk cache size in entries
- Specify a maximum number of cache entries.
- In the Performance settings section, select High performance and high memory usage. The memory usage increases in proportion with the disk cache size.
- In the Eviction policy section, select Random from the Algorithm list. In the High threshold field, specify 80%. In the Low threshold field, specify 70%.
- Optional: If more than one server is defined, in the Consistency Settings section, select a replication domain. If no domain is displayed in the list, click Create a new replication domain.
- Optional: In the Replication type section, start by selecting Not Shared. In the Push frequency field type 1.
- Click Apply.
- Click Servers > Application Servers > your_Commerce_Application_Name > Java and Process Management > Process Definition > Java Virtual Machine > Custom Properties
- Define the following properties, if they are not already defined:
Custom Property Name Value com.ibm.ws.cache.CacheConfig.filterLRUInvalidation true com.ibm.ws.cache.CacheConfig.filterTimeOutInvalidation true com.ibm.ws.cache.CacheConfig.filterInactivityInvalidation true com.ibm.ws.cache.CacheConfig.disableTemplateInvalidation true com.ibm.ws.cache.CacheConfig.ignoreValueInInvalidationEvent true com.ibm.ws.cache.CacheConfig.useServerClassLoader true com.ibm.ws.cache.CacheConfig.disableStoreCookies ALL com.ibm.ws.cache.CacheConfig.cascadeCachespecProperties true com.ibm.ws.CacheConfig.alwaysTriggerCommandInvalidations true com.ibm.ws.cache.CacheConfig.htodDependencyCacheIndexEnabled true
- Configure the baseCache to use the WebSphere eXtreme Scale service provider.
- Open the WebSphere Application Server administrative console.
- Expand Servers > Server Type. Click WebSphere Application Servers > your_Commerce_Application_Name.
- From the Cache provider list, select WebSphere eXtreme Scale.
- In the Cache size field, specify a cache size. Start with the default setting of 2000.
- Select the Enable cache replication check box.
- Click Apply.
- Click Servers > Application Servers > your_Commerce_Application_Name > Java and Process Management > Process Definition > Java Virtual Machine > Custom Properties
- Define the following properties, if they are not already defined:
Custom Property Name Value com.ibm.ws.cache.CacheConfig.filterLRUInvalidation true com.ibm.ws.cache.CacheConfig.filterTimeOutInvalidation true com.ibm.ws.cache.CacheConfig.filterInactivityInvalidation true com.ibm.ws.cache.CacheConfig.disableTemplateInvalidation true com.ibm.ws.cache.CacheConfig.ignoreValueInInvalidationEvent true com.ibm.ws.cache.CacheConfig.useServerClassLoader true com.ibm.ws.cache.CacheConfig.disableStoreCookies ALL com.ibm.ws.cache.CacheConfig.cascadeCachespecProperties true com.ibm.ws.CacheConfig.alwaysTriggerCommandInvalidations true 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.
- For more information about the service settings for dynamic caching, see Dynamic cache service settings.
- For additional caching, enable the data cache to use the object caches defined in the samples/dynacache/cacheinstances.properties file. For more information see,
Enable WebSphere Commerce data cache
Related concepts
Production environments