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

xxyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/master by this push:
     new 159a0ff  KYLIN-4653 Make the capacity for the LinkedBlockingQueue of 
BlockingReservoir configurable
159a0ff is described below

commit 159a0fffe0aff2babd7d6f97bab7de6c7dc2be35
Author: XiaoxiangYu <hit_la...@126.com>
AuthorDate: Tue Jul 28 21:40:13 2020 +0800

    KYLIN-4653 Make the capacity for the LinkedBlockingQueue of 
BlockingReservoir configurable
---
 .github/workflows/maven.yml                             | 17 +++++++++++++++++
 .../kylin/metrics/lib/impl/BlockingReservoir.java       |  8 ++++----
 server/src/main/resources/kylinMetrics.xml              |  5 +++--
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index c8aeb3a..77ff0a9 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,3 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 # This workflow will build a Java project with Maven
 # For more information see: 
https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
 
diff --git 
a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/BlockingReservoir.java
 
b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/BlockingReservoir.java
index afa34a9..7b4d07c 100644
--- 
a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/BlockingReservoir.java
+++ 
b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/BlockingReservoir.java
@@ -39,7 +39,7 @@ import 
org.apache.kylin.shaded.com.google.common.util.concurrent.ThreadFactoryBu
 public class BlockingReservoir extends AbstractActiveReservoir {
 
     private static final Logger logger = 
LoggerFactory.getLogger(BlockingReservoir.class);
-    private static final int MAX_QUEUE_SIZE = 50000;
+    private static final int MAX_QUEUE_SIZE = 500000;
 
     /**
      * Cache for metrics message with max size is maxReportSize
@@ -60,7 +60,7 @@ public class BlockingReservoir extends 
AbstractActiveReservoir {
     }
 
     public BlockingReservoir(int minReportSize, int maxReportSize, int 
maxReportTime) {
-        this(minReportSize, maxReportSize, maxReportSize, MAX_QUEUE_SIZE);
+        this(minReportSize, maxReportSize, maxReportTime, MAX_QUEUE_SIZE);
     }
 
     public BlockingReservoir(int minReportSize, int maxReportSize, int 
maxReportTime, int maxQueueSize) {
@@ -68,11 +68,11 @@ public class BlockingReservoir extends 
AbstractActiveReservoir {
         Preconditions.checkArgument(maxReportSize >= minReportSize,
                 "maxReportSize should not be less than minBatchSize");
         Preconditions.checkArgument(maxReportTime > 0, "maxReportTime should 
be larger than 0");
-        this.minReportSize = minReportSize;
         this.maxReportSize = maxReportSize;
         this.maxReportTime = maxReportTime * 60 * 1000L;
 
-        this.recordsQueue = new LinkedBlockingQueue<>(maxQueueSize);
+        this.recordsQueue = maxQueueSize <= 0 ? new LinkedBlockingQueue<>() : 
new LinkedBlockingQueue<>(maxQueueSize);
+        this.minReportSize = minReportSize;
         this.listeners = Lists.newArrayList();
 
         this.records = Lists.newArrayListWithExpectedSize(this.maxReportSize);
diff --git a/server/src/main/resources/kylinMetrics.xml 
b/server/src/main/resources/kylinMetrics.xml
index a9d907a..dea04b2 100644
--- a/server/src/main/resources/kylinMetrics.xml
+++ b/server/src/main/resources/kylinMetrics.xml
@@ -39,9 +39,10 @@
             <value>10</value>
         </constructor-arg>
 
-        <!-- maxQueueSize, max queue size of LinkedBlockingQueue-->
+        <!-- maxQueueSize, max queue size of records in BlockingReservoir;
+            set zero or a negative number if you prefer a unbounded 
LinkedBlockingQueue -->
         <constructor-arg index="3">
-            <value>50000</value>
+            <value>500000</value>
         </constructor-arg>
     </bean>
 

Reply via email to