Stats rework (1/3): Interfaces and implementations for tiers#24
Stats rework (1/3): Interfaces and implementations for tiers#24peteralfonsi wants to merge 34 commits intoehcache-disk-integ-basefrom
Conversation
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
…cheStatsDimension Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
…te stats Signed-off-by: Peter Alfonsi <petealft@amazon.com>
…ended on it Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
67e68c4 to
6059680
Compare
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
e28c01d to
36c600d
Compare
| public static final String TIER_DIMENSION_VALUE_ON_HEAP = "on_heap"; | ||
| public static final String TIER_DIMENSION_VALUE_DISK = "disk"; |
There was a problem hiding this comment.
This should not be declared here. Should be present in respective caches.
| } | ||
| cache = cacheBuilder.build(); | ||
| this.eventListener = builder.getEventListener(); | ||
| String dimensionName = Objects.requireNonNull(builder.shardIdDimensionName, "Shard id dimension name can't be null"); |
There was a problem hiding this comment.
This cache shouldn't be limited to a specific dimension. It is used by IRC this way but we need to make it generic(in terms of dimension) going forward. Same with other caches.
| cache = cacheBuilder.build(); | ||
| this.eventListener = builder.getEventListener(); | ||
| String dimensionName = Objects.requireNonNull(builder.shardIdDimensionName, "Shard id dimension name can't be null"); | ||
| this.stats = new SingleDimensionCacheStats(dimensionName, CacheStatsDimension.TIER_DIMENSION_VALUE_ON_HEAP); |
There was a problem hiding this comment.
This doesn't look right. Why are we limiting this to a single dimension?
| * A CacheStats implementation for caches that aggregate over a single dimension, as well as holding a tier dimension. | ||
| * For example, caches in the IndicesRequestCache only aggregate over ShardId value. | ||
| */ | ||
| public class SingleDimensionCacheStats implements CacheStats { |
There was a problem hiding this comment.
Lets not do this. In case I want to have multiple dimension, I would have to implement another class?
EhcacheDiskCache or onHeap cache should have the capability to support multiple dimensions from the start and keep it generic.
You can implement this support multiple dimensions and it can be used to have a single dimension if needed. That makes it extensible.
| Objects.requireNonNull(builder.getWeigher(), "Weigher function can't be null"), | ||
| this.valueSerializer); | ||
| this.cache = buildCache(Duration.ofMillis(expireAfterAccess.getMillis()), builder); | ||
| this.shardIdDimensionName = Objects.requireNonNull(builder.shardIdDimensionName, "Dimension name can't be null"); |
There was a problem hiding this comment.
This is not right. We shouldn't be limiting this to a single dimension that too hardcoding it to be shardId specific.
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com>
Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Description
Changes stats for ICache to be tracked by ICache implementations themselves, using the CacheStats object. ICache<K, V> implementations now take in ICacheKey, which contains a K as well as a list of CacheStatsDimension objects. This contains information that can be used to aggregate cache stats. For example, you might want to aggregate by shard ID value. CacheStats can return values either in total or using a list of dimensions.
Also modifies EhcacheDiskCache and OpenSearchOnHeapCache to use the changes to ICache, and to use the new SingleDimensionCacheStats objects to track their stats.
Related Issues
Part of tiered caching (stats rework)
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.