Use SlidingTimeWindowArrayReservoir to reduce memory consumption

Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/143420c4
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/143420c4
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/143420c4

Branch: refs/heads/master
Commit: 143420c4f460636a82d5f53a6a9a22bdb6bc9ff6
Parents: 3a73b0f
Author: hrzhang <[email protected]>
Authored: Tue Nov 14 14:49:47 2017 -0800
Committer: Junkai Xue <[email protected]>
Committed: Wed Jan 24 18:31:05 2018 -0800

----------------------------------------------------------------------
 helix-core/pom.xml                                        |  2 +-
 .../helix/monitoring/mbeans/ClusterEventMonitor.java      |  6 +++---
 .../helix/monitoring/mbeans/HelixCallbackMonitor.java     |  4 ++--
 .../helix/monitoring/mbeans/MessageLatencyMonitor.java    |  4 ++--
 .../apache/helix/monitoring/mbeans/ResourceMonitor.java   |  4 ++--
 .../helix/monitoring/mbeans/ZkClientPathMonitor.java      | 10 +++++-----
 6 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/143420c4/helix-core/pom.xml
----------------------------------------------------------------------
diff --git a/helix-core/pom.xml b/helix-core/pom.xml
index d833627..4855d7c 100644
--- a/helix-core/pom.xml
+++ b/helix-core/pom.xml
@@ -157,7 +157,7 @@ under the License.
     <dependency>
       <groupId>io.dropwizard.metrics</groupId>
       <artifactId>metrics-core</artifactId>
-      <version>3.1.2</version>
+      <version>3.2.3</version>
     </dependency>
   </dependencies>
   <build>

http://git-wip-us.apache.org/repos/asf/helix/blob/143420c4/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java
 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java
index 8c77466..25b7894 100644
--- 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java
+++ 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java
@@ -20,7 +20,7 @@ package org.apache.helix.monitoring.mbeans;
  */
 
 import com.codahale.metrics.Histogram;
-import com.codahale.metrics.SlidingTimeWindowReservoir;
+import com.codahale.metrics.SlidingTimeWindowArrayReservoir;
 import java.util.concurrent.TimeUnit;
 import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider;
 import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric;
@@ -57,7 +57,7 @@ public class ClusterEventMonitor extends DynamicMBeanProvider 
{
     _clusterStatusMonitor = clusterStatusMonitor;
 
     _duration = new HistogramDynamicMetric("DurationGauge", new Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _count = new SimpleDynamicMetric("EventCounter", 0l);
     _maxDuration = new SimpleDynamicMetric("MaxSingleDurationGauge", 0l);
     _totalDuration = new SimpleDynamicMetric("TotalDurationCounter", 0l);
@@ -69,7 +69,7 @@ public class ClusterEventMonitor extends DynamicMBeanProvider 
{
     _clusterStatusMonitor = clusterStatusMonitor;
 
     _duration = new HistogramDynamicMetric("DurationGauge", new Histogram(
-        new SlidingTimeWindowReservoir(histogramTimeWindowMs, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(histogramTimeWindowMs, 
TimeUnit.MILLISECONDS)));
     _count = new SimpleDynamicMetric("EventCounter", 0l);
     _maxDuration = new SimpleDynamicMetric("MaxSingleDurationGauge", 0l);
     _totalDuration = new SimpleDynamicMetric("TotalDurationCounter", 0l);

http://git-wip-us.apache.org/repos/asf/helix/blob/143420c4/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java
 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java
index 0fc2001..4c595da 100644
--- 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java
+++ 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java
@@ -20,7 +20,7 @@ package org.apache.helix.monitoring.mbeans;
  */
 
 import com.codahale.metrics.Histogram;
-import com.codahale.metrics.SlidingTimeWindowReservoir;
+import com.codahale.metrics.SlidingTimeWindowArrayReservoir;
 import org.apache.helix.HelixConstants;
 import org.apache.helix.InstanceType;
 import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider;
@@ -64,7 +64,7 @@ public class HelixCallbackMonitor extends 
DynamicMBeanProvider {
             changeType.name());
 
     _latencyGauge = new HistogramDynamicMetric("LatencyGauge", new Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _totalLatencyCounter = new SimpleDynamicMetric("LatencyCounter", 0l);
     _unbatchedCounter = new SimpleDynamicMetric("UnbatchedCounter", 0l);
     _counter = new SimpleDynamicMetric("Counter", 0l);

http://git-wip-us.apache.org/repos/asf/helix/blob/143420c4/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java
 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java
index dac5826..a496eab 100644
--- 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java
+++ 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java
@@ -20,7 +20,7 @@ package org.apache.helix.monitoring.mbeans;
  */
 
 import com.codahale.metrics.Histogram;
-import com.codahale.metrics.SlidingTimeWindowReservoir;
+import com.codahale.metrics.SlidingTimeWindowArrayReservoir;
 import java.util.concurrent.TimeUnit;
 import org.apache.helix.model.Message;
 import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider;
@@ -49,7 +49,7 @@ public class MessageLatencyMonitor extends 
DynamicMBeanProvider {
         "MessageLatency");
 
     _messageLatencyGauge = new HistogramDynamicMetric("MessagelatencyGauge", 
new Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _totalMessageLatency = new SimpleDynamicMetric("TotalMessageLatency", 0l);
     _totalMessageCount = new SimpleDynamicMetric("TotalMessageCount", 0l);
   }

http://git-wip-us.apache.org/repos/asf/helix/blob/143420c4/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
index 662f323..7c8382e 100644
--- 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
+++ 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
@@ -20,7 +20,7 @@ package org.apache.helix.monitoring.mbeans;
  */
 
 import com.codahale.metrics.Histogram;
-import com.codahale.metrics.SlidingTimeWindowReservoir;
+import com.codahale.metrics.SlidingTimeWindowArrayReservoir;
 import java.util.concurrent.TimeUnit;
 import org.apache.helix.HelixDefinedState;
 import org.apache.helix.model.ExternalView;
@@ -118,7 +118,7 @@ public class ResourceMonitor extends DynamicMBeanProvider {
 
     _partitionTopStateHandoffDurationGauge =
         new HistogramDynamicMetric("PartitionTopStateHandoffDurationGauge", 
new Histogram(
-            new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+            new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _totalMessageReceived = new SimpleDynamicMetric("TotalMessageReceived", 
0l);
     _maxSinglePartitionTopStateHandoffDuration =
         new 
SimpleDynamicMetric("MaxSinglePartitionTopStateHandoffDurationGauge", 0l);

http://git-wip-us.apache.org/repos/asf/helix/blob/143420c4/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java
 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java
index bc6a36b..2c06eb0 100644
--- 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java
+++ 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java
@@ -20,7 +20,7 @@ package org.apache.helix.monitoring.mbeans;
  */
 
 import com.codahale.metrics.Histogram;
-import com.codahale.metrics.SlidingTimeWindowReservoir;
+import com.codahale.metrics.SlidingTimeWindowArrayReservoir;
 import java.util.concurrent.TimeUnit;
 import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider;
 import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric;
@@ -104,13 +104,13 @@ public class ZkClientPathMonitor extends 
DynamicMBeanProvider {
     _readCounter = new SimpleDynamicMetric("ReadCounter", 0l);
 
     _readLatencyGauge = new HistogramDynamicMetric("ReadLatencyGauge", new 
Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _writeLatencyGauge = new HistogramDynamicMetric("WriteLatencyGauge", new 
Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _readBytesGauge = new HistogramDynamicMetric("ReadBytesGauge", new 
Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
     _writeBytesGauge = new HistogramDynamicMetric("WriteBytesGauge", new 
Histogram(
-        new SlidingTimeWindowReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
+        new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, 
TimeUnit.MILLISECONDS)));
   }
 
   public ZkClientPathMonitor register() throws JMException {

Reply via email to