You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/07/27 00:46:33 UTC
[incubator-pulsar] branch master updated: Fix batching time in perf
producer to allow to disable batching (#2244)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 46e6ea8 Fix batching time in perf producer to allow to disable batching (#2244)
46e6ea8 is described below
commit 46e6ea8b5c481165ef09ff35f878bad41b9015b3
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Thu Jul 26 17:46:30 2018 -0700
Fix batching time in perf producer to allow to disable batching (#2244)
### Motivation
Allow to disable batching in perf producer or to configure a grouping time < 1 millis.
---
.../java/org/apache/pulsar/testclient/PerformanceProducer.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java
index 3a27799..0643fe7 100644
--- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java
+++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java
@@ -130,7 +130,7 @@ public class PerformanceProducer {
public String payloadFilename = null;
@Parameter(names = { "-b",
"--batch-time-window" }, description = "Batch messages in 'x' ms window (Default: 1ms)")
- public long batchTime = 1;
+ public double batchTimeMillis = 1.0;
@Parameter(names = { "-time",
"--test-duration" }, description = "Test duration in secs. If 0, it will keep publishing")
@@ -272,8 +272,12 @@ public class PerformanceProducer {
// enable round robin message routing if it is a partitioned topic
.messageRoutingMode(MessageRoutingMode.RoundRobinPartition);
- if (arguments.batchTime > 0) {
- producerBuilder.batchingMaxPublishDelay(arguments.batchTime, TimeUnit.MILLISECONDS).enableBatching(true);
+ if (arguments.batchTimeMillis == 0.0) {
+ producerBuilder.enableBatching(false);
+ } else {
+ long batchTimeUsec = (long) (arguments.batchTimeMillis * 1000);
+ producerBuilder.batchingMaxPublishDelay(batchTimeUsec, TimeUnit.MICROSECONDS)
+ .enableBatching(true);
}
// Block if queue is full else we will start seeing errors in sendAsync