Skip to content

Commit 6647032

Browse files
author
Vyacheslav Artemyev
committed
Add Throughput benchmark
1 parent 4189b67 commit 6647032

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

benchmarks/src/jmh/kotlin/com.viartemev.thewhiterabbit/ConfirmPublisherBenchmark.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import java.util.concurrent.TimeUnit
2828
@Warmup(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS)
2929
@Measurement(iterations = 1, time = 5, timeUnit = TimeUnit.SECONDS)
3030
@Fork(value = 2)
31-
@BenchmarkMode(Mode.AverageTime)
32-
@OutputTimeUnit(TimeUnit.MICROSECONDS)
3331
@State(Scope.Benchmark)
3432
open class ConfirmPublisherBenchmark {
3533

@@ -59,9 +57,19 @@ open class ConfirmPublisherBenchmark {
5957
}
6058

6159
@Benchmark
62-
fun sendWithPublishConfirm(blackhole: Blackhole) = runBlocking {
60+
@BenchmarkMode(Mode.AverageTime)
61+
@OutputTimeUnit(TimeUnit.MICROSECONDS)
62+
fun avgTimeSendWithPublishConfirm(blackhole: Blackhole) = runBlocking {
6363
blackhole.consume(publisher.publishWithConfirmAsync(messages = messages).awaitAll())
6464
}
6565

66+
@Benchmark
67+
@BenchmarkMode(Mode.Throughput)
68+
@OutputTimeUnit(TimeUnit.MICROSECONDS)
69+
fun throughputSendWithPublishConfirm(blackhole: Blackhole) = runBlocking {
70+
blackhole.consume(publisher.publishWithConfirmAsync(messages = messages).awaitAll())
71+
}
72+
73+
6674
private fun createMessage(): OutboundMessage = OutboundMessage("", testQueueName, MessageProperties.MINIMAL_BASIC, "")
6775
}

0 commit comments

Comments
 (0)