Skip to content

Commit

Permalink
Revert "[Java] Automatically increase send interval to match the targ…
Browse files Browse the repository at this point in the history
…et message rate when calculating the batch size."

This reverts commit c8338dd.
  • Loading branch information
vyazelenko committed Feb 9, 2024
1 parent c8338dd commit b383710
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b383710

Please sign in to comment.