Configure Cache Expiration Lifespan
During our performance testing activity, we used the 'Cache hit %' metric to understand how caching improves performance. This metric indicates the percentage of overall data requests that were successfully retrieved from the cache.
Cache hit % = (Number of cache hits)/(Total number of requests) * 100
When the Cache hit % is more than 95%, we noticed an improvement of 20 to 30% in the update deployment performance.
To achieve optimal performance improvement with caching, we need a high Cache hit %. Cache hit % depends on the quantity of cached data. Configuring the correct Cache Expiration Lifespan ensures that we have enough cached data to achieve a high Cache Hit % and thereby, optimal performance improvement.
Depending on the cache setup, you can set the Cache Expiration Lifespan in two ways: Notes:
- To begin with, try setting the Cache Expiration Lifespan to 8 hours and continue to tweak it based on the change in performance.
- Ensure that all CI caches have the same expiration lifespan.
- In an Embedded cache setup where the cache resides in the same machine as the Deploy instance, follow these steps:
a. Go to
XL_DEPLOY_SERVER_HOME/centralConfiguration/
. b. Open thedeploy-caches.yaml
file and set thettl-minutes
field to the desired duration in minutes. Perform this step for all CI caches. - In a distributed cache setup, follow these steps:
Note: This example is based on the Infinispan cache server.
a. Go to
XL_DEPLOY_SERVER_HOME/conf/
. b. Open theinfinispan-hotrod.properties
file and set theexpiration lifespan
parameter to the desired duration in milliseconds. Perform this step for all CI caches. Note: In case of distributed cache, theexpiration lifespan
property ininfinispan-hotrod.properties
takes precedence over thettl-minutes
field in thedeploy-caches.yaml
file.
The correct Cache Expiration Lifespan for your setup depends on factors such as the deployment window, number of deployed applications, usage patterns, and so on. We recommend trying different values until you arrive at the value that can ensure the best performance.