You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2019/02/20 21:34:24 UTC

[GitHub] akshayrai commented on a change in pull request #3842: [TE] detection - time series provider loading cache

akshayrai 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_r258683663
 
 

 ##########
 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)
+          .expireAfterWrite(15, TimeUnit.MINUTES)
 
 Review comment:
   Can you include a comment stating that these values are chosen randomly and needs to be tuned.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org