You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2021/01/17 15:17:52 UTC
[kylin] 06/07: KYLIN-4653 Make the capacity for the
LinkedBlockingQueue of BlockingReservoir configurable
This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch kylin-on-parquet-v2
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 5b3859c9d6871cd001a39ece43c856275215e01b
Author: XiaoxiangYu <hi...@126.com>
AuthorDate: Tue Jul 28 21:40:13 2020 +0800
KYLIN-4653 Make the capacity for the LinkedBlockingQueue of BlockingReservoir configurable
(cherry picked from commit 159a0fffe0aff2babd7d6f97bab7de6c7dc2be35)
---
.github/workflows/maven.yml | 10 ++++++----
.../org/apache/kylin/metrics/lib/impl/BlockingReservoir.java | 8 ++++----
server/src/main/resources/kylinMetrics.xml | 5 +++--
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index b2e447c..77ff0a9 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,13 +1,12 @@
-# Configuration file for Travis continuous integration.
#
# 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 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
+# 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,
@@ -16,6 +15,9 @@
# 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
+
name: Java CI with Maven
on:
@@ -36,4 +38,4 @@ jobs:
with:
java-version: 1.8
- name: Build with Maven
- run: mvn clean -Dpre-commit apache-rat:check test -Dlicense.skip=false
+ run: mvn -B package --file pom.xml
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>