Configuring Request-Scoped Caching
Configuring Request-Scoped Caching
Configuring Cache Eviction
By default, the request-scoped cache is configured to evict cached entries after 60 sec and when the number of cached entries reaches 2147483647. Parameters are configurable via the RelOS Request Cache OSGi configuration in the Apache Felix Web Console. Caches are destroyed and rebuilt when configuration values are updated through the Felix console.
Logging Caching
To activate cache logging, add the following to the logback.xml file located in the cortex/relos/logback-config/src/main/filtered-resources/ directory.
<logger name="com.elasticpath.rest.resource.integration.epcommerce.repository" level="TRACE"/commerce-legacy/>Cache logging dramatically decreases cache performance as it will log a lot of information.
To see the resource operation's external operation ID, add the following to logback.xml:
<logger name="com.elasticpath.rest.cache.guava.impl" level="TRACE"/commerce-legacy/>
Cache Metrics Monitoring
Request-scoped cache metrics are exposed as MBeans over Cortex's JMX API. The metrics Mbeans are identified by the naming pattern EP-RelOS.*.RequestCache.*.
Metrics available to monitor:
- evictionCount – number of times entries have been evicted
- hitCount – number of times entries have been looked up and found
- hitRate – ratio of cache request which were hits
- loadCount – number of times entries have been looked up
- missCount – number of times entries have been looked up and missed
- missRate – ratio of cache requests which weren't hits
- requestCount – number of times entries have been looked up