Skip to content

Commit b583620

Browse files
committed
Add batch publishing delay option in performance tool
Default in client is 100 ms, same in performance tool. Adding the option provides more flexibility for workloads with a low number of outstanding confirms. Fixes #259
1 parent 5bd9610 commit b583620

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/com/rabbitmq/stream/perf/StreamPerfTest.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import static com.rabbitmq.stream.perf.Utils.ENVIRONMENT_VARIABLE_PREFIX;
1818
import static com.rabbitmq.stream.perf.Utils.OPTION_TO_ENVIRONMENT_VARIABLE;
1919
import static java.lang.String.format;
20+
import static java.time.Duration.ofMillis;
2021

2122
import com.google.common.util.concurrent.RateLimiter;
2223
import com.rabbitmq.client.Channel;
@@ -203,6 +204,13 @@ public class StreamPerfTest implements Callable<Integer> {
203204
converter = Utils.PositiveIntegerTypeConverter.class)
204205
private int batchSize;
205206

207+
@CommandLine.Option(
208+
names = {"--batch-publishing-delay", "-bpd"},
209+
description = "Period to send a batch of messages in milliseconds",
210+
defaultValue = "100",
211+
converter = Utils.GreaterThanOrEqualToZeroIntegerTypeConverter.class)
212+
private int batchPublishingDelay;
213+
206214
@CommandLine.Option(
207215
names = {"--sub-entry-size", "-ses"},
208216
description = "number of messages packed into a normal message entry",
@@ -763,7 +771,10 @@ public Integer call() throws Exception {
763771
}
764772

765773
String stream = stream(this.streams, i);
766-
ProducerBuilder producerBuilder = environment.producerBuilder();
774+
ProducerBuilder producerBuilder =
775+
environment
776+
.producerBuilder()
777+
.batchPublishingDelay(ofMillis(this.batchPublishingDelay));
767778

768779
String producerName = this.producerNameStrategy.apply(stream, i + 1);
769780
if (producerName != null && !producerName.trim().isEmpty()) {

0 commit comments

Comments
 (0)