jihaozh commented on a change in pull request #3842: [TE] detection - time
series provider loading cache
URL: https://github.com/apache/incubator-pinot/pull/3842#discussion_r258691454
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DefaultDataProvider.java
##########
@@ -84,27 +87,38 @@ public DefaultDataProvider(MetricConfigManager metricDAO,
DatasetConfigManager d
this.timeseriesLoader = timeseriesLoader;
this.aggregationLoader = aggregationLoader;
this.loader = loader;
- this.timeseriesCache = CacheBuilder.newBuilder()
- .maximumSize(100)
- .expireAfterWrite(30, TimeUnit.MINUTES)
- .build(new CacheLoader<MetricSlice, DataFrame>() {
- @Override
- public DataFrame load(MetricSlice slice) {
- return fetchTimeseries(Collections.singleton(slice)).get(slice);
- }
- });
- }
+ if (DETECTION_TIME_SERIES_CACHE == null) {
+ LOG.info("initializing detection timeseries cache");
+ DETECTION_TIME_SERIES_CACHE = CacheBuilder.newBuilder()
+ // don't use more than one third of memory for detection time series
+ .maximumWeight(Runtime.getRuntime().freeMemory() / 3)
Review comment:
It's hard to estimate how much would be enough. (Depends on how many
detection jobs is running, etc). If set too low, the performance suffers, if
set too high, the cache would eat too much memory. To cap it to one-third of
memory is reasonable I think. added a log there to show the cache size.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]