Enabling the dynamic cache service and servlet caching

For local stores running in the Development environment, you 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:
  1. Data caching is enabled by default for remote stores. In the default Store server Docker container, you 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.
  2. 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).
  3. In the development environment, servlet caching is disabled. To enable and use servlet caching, see the Enabling the dynamic cache service and servlet caching topic.

Procedure

  • To ensure that the dynamic cache service is enabled, see the Enabling the dynamic cache service topics.
  • Configuring the baseCache to use the default Dynamic Cache service provider.
    1. Open the WebSphere Application Server administrative console.
    2. Expand Servers > Server Type. Click WebSphere Application Servers > your_Commerce_Application_Name.
    3. In the Container Settings section, expand Container services. Click Dynamic cache service.
    4. From the Cache provider list, select Default dynamic cache.
    5. Optional: If more than one server is defined:
      1. Check Enable cache replication.
      2. Ensure the replication domain and replication type of all out of box DistributedMap object caches are specified.
        1. Open the WebSphere Application Server Integrated Solutions Console.
        2. From the left menu, click Resources > Cache instances > Object cache instances.
    6. In the Cache size field, specify a cache size. Start with the default setting of 2000.
    7. In the Memory Cache Size section, ensure that the Limit memory cache size check box is not selected.
    8. In the Disk Cache settings section, ensure that the Enable disk offload check box is selected.
      1. 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.
      2. 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.
    9. In the Performance settings section, select High performance and high memory usage. The memory usage increases in proportion with the disk cache size.
    10. 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%.
    11. 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.
    12. Optional: In the Replication type section, start by selecting Not Shared. In the Push frequency field type 1.
    13. Click Apply.
    14. Click Servers > Application Servers > your_Commerce_Application_Name > Java and Process Management > Process Definition > Java Virtual Machine > Custom Properties
    15. 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.
    1. Open the WebSphere Application Server administrative console.
    2. Expand Servers > Server Type. Click WebSphere Application Servers > your_Commerce_Application_Name.
    3. From the Cache provider list, select WebSphere eXtreme Scale.
    4. In the Cache size field, specify a cache size. Start with the default setting of 2000.
    5. Select the Enable cache replication check box.
    6. Click Apply.
    7. Click Servers > Application Servers > your_Commerce_Application_Name > Java and Process Management > Process Definition > Java Virtual Machine > Custom Properties
    8. 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, Configuring HCL Commerce data cache