Skip to content

Commit

Permalink
Use millisecond granularity for publisher ramp-up period
Browse files Browse the repository at this point in the history
It was seconds, which works for very long ramp-up period
(e.g. 60 seconds or more) and a small number of publishers
(few 100s), but not short ramp-up period and large numbers
of publishers (start 5000 publishers in 15 seconds). In such
cases, the workload was not random enough like in real-life
and metrics like publisher confirm latency could be much
higher than expected.

References #394
  • Loading branch information
acogoluegnes committed Oct 5, 2022
1 parent b0772a8 commit 67929a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/rabbitmq/perf/MulticastSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,9 @@ PRODUCER_THREAD_PREFIX, nbThreadsForProducerScheduledExecutorService(params)
Supplier<Duration> startDelaySupplier;
if (params.getProducerRandomStartDelayInSeconds() > 0) {
Random random = new Random();
startDelaySupplier = () -> Duration.ofSeconds(
random.nextInt(params.getProducerRandomStartDelayInSeconds()) + 1
int bound = params.getProducerRandomStartDelayInSeconds() * 1000;
startDelaySupplier = () -> Duration.ofMillis(
random.nextInt(bound) + 1
);
} else {
startDelaySupplier = () -> Duration.ZERO;
Expand Down

0 comments on commit 67929a6

Please sign in to comment.