-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stats rework (1/3): Interfaces and implementations for tiers #24
base: ehcache-disk-integ-base
Are you sure you want to change the base?
Conversation
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
…cheStatsDimension Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
…te stats Signed-off-by: Peter Alfonsi <[email protected]>
…ended on it Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
67e68c4
to
6059680
Compare
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be declared here. Should be present in respective caches.
.setMaximumWeight(builder.getMaxWeightInBytes()) | ||
.weigher(builder.getWeigher()) | ||
.removalListener(this); | ||
if (builder.getExpireAfterAcess() != null) { | ||
cacheBuilder.setExpireAfterAccess(builder.getExpireAfterAcess()); | ||
} | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
.setMaximumWeight(builder.getMaxWeightInBytes()) | ||
.weigher(builder.getWeigher()) | ||
.removalListener(this); | ||
if (builder.getExpireAfterAcess() != null) { | ||
cacheBuilder.setExpireAfterAccess(builder.getExpireAfterAcess()); | ||
} | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Sagar Upadhyaya <[email protected]>
Signed-off-by: Sagar Upadhyaya <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
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.