From b3837103f2e4034699bf6cd8931df3583549abdc Mon Sep 17 00:00:00 2001 From: Dmitry Vyazelenko <696855+vyazelenko@users.noreply.github.com> Date: Fri, 9 Feb 2024 22:42:37 +0100 Subject: [PATCH] Revert "[Java] Automatically increase send interval to match the target message rate when calculating the batch size." This reverts commit c8338dd3ac0229f5fd2cbb68dc95ede8f7879379. --- .../benchmarks/remote/LoadTestRig.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/benchmarks-api/src/main/java/uk/co/real_logic/benchmarks/remote/LoadTestRig.java b/benchmarks-api/src/main/java/uk/co/real_logic/benchmarks/remote/LoadTestRig.java index 50bac21b..a6be8dd7 100644 --- a/benchmarks-api/src/main/java/uk/co/real_logic/benchmarks/remote/LoadTestRig.java +++ b/benchmarks-api/src/main/java/uk/co/real_logic/benchmarks/remote/LoadTestRig.java @@ -175,20 +175,8 @@ long send(final int iterations, final int numberOfMessages) // The `sendIntervalNs` might be off if the division is not exact in which case more messages will be sent per // second than specified via `numberOfMessages`. However, this guarantees that the duration of the send // operation is bound by the number of iterations. - long sendIntervalNs = Math.max(NANOS_PER_SECOND / numberOfMessages, configuration.messageSendDelayNs()); - int burstSize = numberOfMessages / (int)(NANOS_PER_SECOND / sendIntervalNs); - while (burstSize * (int)(NANOS_PER_SECOND / sendIntervalNs) < numberOfMessages) - { - sendIntervalNs *= 10; - if (sendIntervalNs > NANOS_PER_SECOND) - { - sendIntervalNs /= 10; - burstSize++; - break; - } - burstSize = numberOfMessages / (int)(NANOS_PER_SECOND / sendIntervalNs); - } - + final long sendIntervalNs = Math.max(NANOS_PER_SECOND / numberOfMessages, configuration.messageSendDelayNs()); + final int burstSize = (int)Math.ceil((double)numberOfMessages / (int)(NANOS_PER_SECOND / sendIntervalNs)); final long totalNumberOfMessages = (long)iterations * numberOfMessages; final long startTimeNs = clock.nanoTime(); final long stopTimeNs = startTimeNs + (iterations * NANOS_PER_SECOND);