You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2018/11/29 19:12:36 UTC

[incubator-pinot] branch add-guage-for-llc-simultaneous-segment-builds created (now e35f4cd)

This is an automated email from the ASF dual-hosted git repository.

jlli pushed a change to branch add-guage-for-llc-simultaneous-segment-builds
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at e35f4cd  Add metric gauge to track the number of llc simultaneous segment builds

This branch includes the following new commits:

     new e35f4cd  Add metric gauge to track the number of llc simultaneous segment builds

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: Add metric gauge to track the number of llc simultaneous segment builds

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jlli pushed a commit to branch add-guage-for-llc-simultaneous-segment-builds
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit e35f4cdecc111341c5acb73935b56db6a9a18871
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Thu Nov 29 11:12:11 2018 -0800

    Add metric gauge to track the number of llc simultaneous segment builds
---
 .../pinot/common/metrics/AbstractMetrics.java      | 29 +++++++++++++++++++++-
 .../linkedin/pinot/common/metrics/ServerGauge.java |  3 ++-
 .../realtime/LLRealtimeSegmentDataManager.java     |  5 ++++
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/AbstractMetrics.java b/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/AbstractMetrics.java
index a9f7f4a..8b26ad6 100644
--- a/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/AbstractMetrics.java
+++ b/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/AbstractMetrics.java
@@ -350,7 +350,6 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
    * @param value The value to set the gauge to
    */
   public void setValueOfGlobalGauge(final G gauge, final long value) {
-    final String fullGaugeName;
     final String gaugeName = gauge.getGaugeName();
 
     if (!_gaugeValues.containsKey(gaugeName)) {
@@ -372,6 +371,34 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
     }
   }
 
+  /**
+   * Logs a value to a table gauge.
+   *
+   * @param gauge The gauge to use
+   * @param unitCount The number of units to add to the gauge
+   */
+  public void addValueToGlobalGauge(final G gauge, final long unitCount) {
+    String gaugeName = gauge.getGaugeName();
+
+    if (!_gaugeValues.containsKey(gaugeName)) {
+      synchronized (_gaugeValues) {
+        if(!_gaugeValues.containsKey(gaugeName)) {
+          _gaugeValues.put(gaugeName, new AtomicLong(unitCount));
+          addCallbackGauge(gaugeName, new Callable<Long>() {
+            @Override
+            public Long call() throws Exception {
+              return _gaugeValues.get(gaugeName).get();
+            }
+          });
+        } else {
+          _gaugeValues.get(gaugeName).addAndGet(unitCount);
+        }
+      }
+    } else {
+      _gaugeValues.get(gaugeName).addAndGet(unitCount);
+    }
+  }
+
   @VisibleForTesting
   public long getValueOfGlobalGauge(final G gauge) {
     String gaugeName = gauge.getGaugeName();
diff --git a/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/ServerGauge.java b/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/ServerGauge.java
index c562ad7..38e848f 100644
--- a/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/ServerGauge.java
+++ b/pinot-common/src/main/java/com/linkedin/pinot/common/metrics/ServerGauge.java
@@ -41,7 +41,8 @@ public enum ServerGauge implements AbstractMetrics.Gauge {
   STREAM_PARTITION_OFFSET_LAG("messages", false),
   REALTIME_OFFHEAP_MEMORY_USED("bytes", false),
   RUNNING_QUERIES("runningQueries", false),
-  REALTIME_SEGMENT_PARTITION_WIDTH("realtimeSegmentPartitionWidth", false);
+  REALTIME_SEGMENT_PARTITION_WIDTH("realtimeSegmentPartitionWidth", false),
+  LLC_SIMULTANEOUS_SEGMENT_BUILDS("llcSimultaneousSegmentBuilds", true);
 
   private final String gaugeName;
   private final String unit;
diff --git a/pinot-core/src/main/java/com/linkedin/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java b/pinot-core/src/main/java/com/linkedin/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java
index ec19064..9e88ccb 100644
--- a/pinot-core/src/main/java/com/linkedin/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java
+++ b/pinot-core/src/main/java/com/linkedin/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java
@@ -626,6 +626,9 @@ public class LLRealtimeSegmentDataManager extends RealtimeSegmentDataManager {
         segmentLogger.info("Waiting to acquire semaphore for building segment");
         _segBuildSemaphore.acquire();
       }
+      // Increment llc simultaneous segment builds.
+      _serverMetrics.addValueToGlobalGauge(ServerGauge.LLC_SIMULTANEOUS_SEGMENT_BUILDS, 1L);
+
       final long lockAquireTimeMillis = now();
       // Build a segment from in-memory rows.If buildTgz is true, then build the tar.gz file as well
       // TODO Use an auto-closeable object to delete temp resources.
@@ -681,6 +684,8 @@ public class LLRealtimeSegmentDataManager extends RealtimeSegmentDataManager {
       if (_segBuildSemaphore != null) {
         _segBuildSemaphore.release();
       }
+      // Decrement llc simultaneous segment builds.
+      _serverMetrics.addValueToGlobalGauge(ServerGauge.LLC_SIMULTANEOUS_SEGMENT_BUILDS, -1L);
     }
   }
 


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