close

Filter

loading table of contents...

Content Application Developer Manual / Version 2512.0

Table Of Contents

3.3.2 In-memory Caching (CacheKey Cache)

Checking Cache Efficiency

Check your project's cache capacity settings before launching a new or overhauled site and when upgrading to a newer CoreMedia CMS release. Use a load test with production-like data and compare eviction rates. The following Prometheus metrics (via /actuator/prometheus) are relevant:

  • coremedia_cache_evictions_total{class="<cache-class>"} — evictions due to exceeded capacity. A high eviction rate relative to reads is a red flag.

  • coremedia_cache_gets_total{class="<cache-class>"} — read accesses. Should be much larger than evictions.

  • coremedia_cache_evaluation_duration_seconds{class="<cache-class>"} — time to compute an item. Helps estimate the cost of evictions.

  • coremedia_cache_level{class="com.coremedia.cap.heap"} — estimated memory consumption of cached elements.

  • jvm_gc_overhead — approximate percentage of CPU time spent on GC.

  • jvm_memory_used_bytes{area="heap"} — used Java heap memory.

Introducing Individual Cache Classes

If no specific cache class is defined in a cache key implementation via CacheKey#cacheClass(Cache, T), the cache traverses the type hierarchy to find a matching configured capacity. If none is found, the value falls into the default cache class java.lang.Object.

Dataview cache entries follow the same mechanism: they use the content bean class as their cache class when a capacity is configured for that class. Otherwise, they fall into AssumesIdentity or java.lang.Object.

To introduce a dedicated cache class, add a capacity configuration for the cache key class.

# capacity of class com.mycompany.MyOuterClass$MyInnerCacheKey
cache.capacities.com.mycompany.MyOuterClass.MyInnerCacheKey=100

Example 3.1. Custom CacheKey Configuration


Introducing dedicated cache classes is recommended when:

  • a high eviction rate is observed and the cache capacity cannot be increased, or

  • the cache consumes too much Java heap and the heap cannot be enlarged.

Use /actuator/cache/java.lang.Object?keys=true to discover which cache key types currently reside in the default cache class.

Note

Note

Consider requesting support from CoreMedia Professional Services when in doubt regarding the procedure of checking and optimizing cache settings.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.