Cortex utilizes Google's Guava caching framework to improve performance for operation results. Cortex caches by request scope, which means caches live for the duration of the request's lifecycle. Once the request processes, cache entries are evicted; thereby freeing up the allocated memory.
Caching Operation Results
Cortex caches the operation results retrieved from the database, so they can be reused throughout the request's lifecycle.
Key Operation Result Caching Classes
- OperationResultCacheProviderImpl - Builds the Guava cache.
- OperationResultCache - Cache for the ResourceOperation context, which has 3 ConcurrentHashMaps containing:
- Actual operation results
- Operation result links
- Number of cache hits (used for informative and debugging purposes)
Operation Results Cache Optimization
By default, Guava cache is configured to evict cached entries either after 30 sec or after number of cached entries reaches 2000. Parameters are configurable via the RelOS OperationResult Cache OSGi configuration in the Felix admin console. Caches are destroyed and rebuilt when configuration values are updated through the Felix console.