You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/06/30 03:33:19 UTC
[skywalking] branch master updated: Fix the queue initial size is
not set by max batch size accordingly (#7204)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 89549c0 Fix the queue initial size is not set by max batch size accordingly (#7204)
89549c0 is described below
commit 89549c0183b1f387d7b0f03f5fc14ce2836f1790
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Wed Jun 30 11:33:07 2021 +0800
Fix the queue initial size is not set by max batch size accordingly (#7204)
---
.../skywalking/oap/server/core/storage/PersistenceTimer.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/PersistenceTimer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/PersistenceTimer.java
index a3f0697..aaafc06 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/PersistenceTimer.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/PersistenceTimer.java
@@ -29,7 +29,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.apm.util.RunnableWithExceptionProtection;
import org.apache.skywalking.oap.server.core.CoreModuleConfig;
@@ -203,16 +202,18 @@ public enum PersistenceTimer {
}
}
- @RequiredArgsConstructor
static class DefaultBlockingBatchQueue<E> implements BlockingBatchQueue<E> {
-
@Getter
private final int maxBatchSize;
-
+ private final List<E> elementData;
@Getter
private boolean inAppendingMode = true;
- private final List<E> elementData = new ArrayList<>(50000 * 3);
+ public DefaultBlockingBatchQueue(final int maxBatchSize) {
+ this.maxBatchSize = maxBatchSize;
+ // Use the maxBatchSize * 3 as the initial queue size to avoid ArrayList#grow
+ this.elementData = new ArrayList<>(maxBatchSize * 3);
+ }
@Override
public void offer(List<E> elements) {