Updating cache sizes

You can independently configure the size of each cache that is used in HCL Commerce. The size of each cache is defined by its number of entries and by its size in megabytes (MB). The number of entries is a maximum size, not the current actual size, and the size in MB is the maximum memory footprint.

HCL Commerce Version 9.1.4.0 or laterNote: With version 9.1.4.0, local HCL Cache caches automatically adjust their maximum sizes lower or higher, depending on the amount of available free memory in the Java Virtual Machine (JVM).

The method to update cache sizes depends on the pod type, and varies between WebSphere Application Server Liberty (Search server, Store server and Customization server) and WebSphere Application Server (Transaction server) pods.

Procedure

Update the size of the cache depending on the application server that is used.
Server typeCache settings
WebSphere Application Server Liberty (Search server, Store server and Customization server) Each cache is defined by its JNDICache, and is represented by an entry in the liberty_installdir/usr/servers/default/server.xml configuration file by an entry similar to the following:
<distributedMap id="JNDICache" memorySizeInEntries="5000" memorySizeInMB="600" 
 cacheProviderName="hcl-cache">
</distributedMap>

You can update the number of entries and/or the size in MB.

To apply the update to a new size:
  1. Create a new XML file, cache.xml, with the same entries as the default liberty_installdir/usr/servers/default/server.xml configuration file.
  2. Modify the number of entries and maximum size values to reflect your required changes.
  3. Use the dockerfile configuration file to copy the new file into the configDropins/overrides/ directory.
    For example, your dockerfile configuration will look similar to the following:
    COPY cache.xml /opt/WebSphere/Liberty/usr/servers/default/configDropins/overrides/cache.xml
  4. Build and deploy a new Docker image.
The cache settings will be overridden by the ones you have set in the configDropins/overrides/cache.xml configuration file.
WebSphere Application Server (Transaction server) A Transaction server run engine command, update-objectcache-size, is available to update cache sizes. With this command, you can update the number of entries and/or the cache size in MB. For more information on Transaction server run engine commands, see Transaction server Run Engine commands.
Some examples of using this command are as follows:
  • To update the number of entries of the PriceCache cache (JNDI name dmap/PriceCache)
    run update-objectcache-size dmap/PriceCache 30000
  • To update the number of entries of the PriceCache cache to 5000, and the size in MB to 400
    run update-objectcache-size dmap/PR_Cache 5000 400
  • To update the number of entries of the basecache to 3000, and the size in MB to 1000
    run update-objectcache-size basecache 3000 1000

Results

The cache size in number of lines, or megabytes in memory is modified to your set requirements.