-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
317 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# JMH version: 1.21 | ||
# VM version: JDK 1.8.0_221, Java HotSpot(TM) 64-Bit Server VM, 25.221-b11 | ||
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/bin/java | ||
# VM options: <none> | ||
# Warmup: 2 iterations, 10 s each | ||
# Measurement: 2 iterations, 10 s each | ||
# Timeout: 10 min per iteration | ||
# Threads: 1 thread, will synchronize iterations | ||
# Benchmark mode: Throughput, ops/time | ||
# Benchmark: monix.kafka.benchmarks.KafkaProducerBenchmark.monixProducer_1P_1RF | ||
# Parameters: (size = 2) | ||
|
||
# Run progress: 0.00% complete, ETA 00:01:20 | ||
# Fork: 1 of 1 | ||
# Warmup Iteration 1: 511.829 ops/s | ||
# Warmup Iteration 2: 568.495 ops/s | ||
Iteration 1: 679.205 ops/s | ||
Iteration 2: 383.040 ops/s | ||
|
||
|
||
Result "monix.kafka.benchmarks.KafkaProducerBenchmark.monixProducer_1P_1RF": | ||
531.122 ops/s | ||
|
||
|
||
# JMH version: 1.21 | ||
# VM version: JDK 1.8.0_221, Java HotSpot(TM) 64-Bit Server VM, 25.221-b11 | ||
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/bin/java | ||
# VM options: <none> | ||
# Warmup: 2 iterations, 10 s each | ||
# Measurement: 2 iterations, 10 s each | ||
# Timeout: 10 min per iteration | ||
# Threads: 1 thread, will synchronize iterations | ||
# Benchmark mode: Throughput, ops/time | ||
# Benchmark: monix.kafka.benchmarks.KafkaProducerBenchmark.monixProducer_2P_1RF | ||
# Parameters: (size = 2) | ||
|
||
# Run progress: 50.00% complete, ETA 00:00:41 | ||
# Fork: 1 of 1 | ||
# Warmup Iteration 1: 388.808 ops/s | ||
# Warmup Iteration 2: 616.387 ops/s | ||
Iteration 1: 453.712 ops/s | ||
Iteration 2: 709.331 ops/s | ||
|
||
|
||
Result "monix.kafka.benchmarks.KafkaProducerBenchmark.monixProducer_2P_1RF": | ||
581.521 ops/s | ||
|
||
|
||
# Run complete. Total time: 00:01:22 | ||
|
||
REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on | ||
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial | ||
experiments, perform baseline and negative tests that provide experimental control, make sure | ||
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts. | ||
Do not assume the numbers tell you what you want them to tell. | ||
|
||
Benchmark (size) Mode Cnt Score Error Units | ||
KafkaProducerBenchmark.monixProducer_1P_1RF 2 thrpt 2 531.122 ops/s | ||
KafkaProducerBenchmark.monixProducer_2P_1RF 2 thrpt 2 581.521 ops/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# JMH version: 1.21 | ||
# VM version: JDK 1.8.0_221, Java HotSpot(TM) 64-Bit Server VM, 25.221-b11 | ||
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/bin/java | ||
# VM options: <none> | ||
# Warmup: 1 iterations, 10 s each | ||
# Measurement: 3 iterations, 10 s each | ||
# Timeout: 10 min per iteration | ||
# Threads: 1 thread, will synchronize iterations | ||
# Benchmark mode: Throughput, ops/time | ||
# Benchmark: monix.kafka.benchmarks.KafkaProducerSinkBenchmark.monixProducer_2P_1RF | ||
|
||
# Run progress: 0.00% complete, ETA 00:01:20 | ||
# Fork: 1 of 1 | ||
# Warmup Iteration 1: 19325650.744 ops/s | ||
Iteration 1: 22719038.623 ops/s | ||
Iteration 2: 18410283.671 ops/s | ||
Iteration 3: 17055280.316 ops/s | ||
|
||
|
||
Result "monix.kafka.benchmarks.KafkaProducerSinkBenchmark.monixProducer_2P_1RF": | ||
19394867.537 ±(99.9%) 53955153.846 ops/s [Average] | ||
(min, avg, max) = (17055280.316, 19394867.537, 22719038.623), stdev = 2957464.046 | ||
CI (99.9%): [≈ 0, 73350021.383] (assumes normal distribution) | ||
|
||
|
||
# JMH version: 1.21 | ||
# VM version: JDK 1.8.0_221, Java HotSpot(TM) 64-Bit Server VM, 25.221-b11 | ||
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/bin/java | ||
# VM options: <none> | ||
# Warmup: 1 iterations, 10 s each | ||
# Measurement: 3 iterations, 10 s each | ||
# Timeout: 10 min per iteration | ||
# Threads: 1 thread, will synchronize iterations | ||
# Benchmark mode: Throughput, ops/time | ||
# Benchmark: monix.kafka.benchmarks.KafkaProducerSinkBenchmark.monixSink_1P_1RF | ||
|
||
# Run progress: 50.00% complete, ETA 00:00:41 | ||
# Fork: 1 of 1 | ||
# Warmup Iteration 1: 14495673.023 ops/s | ||
Iteration 1: 16978439.192 ops/s | ||
Iteration 2: 14236465.295 ops/s | ||
Iteration 3: 15592697.505 ops/s | ||
|
||
|
||
Result "monix.kafka.benchmarks.KafkaProducerSinkBenchmark.monixSink_1P_1RF": | ||
15602533.997 ±(99.9%) 25012388.495 ops/s [Average] | ||
(min, avg, max) = (14236465.295, 15602533.997, 16978439.192), stdev = 1371013.414 | ||
CI (99.9%): [≈ 0, 40614922.492] (assumes normal distribution) | ||
|
||
|
||
# Run complete. Total time: 00:01:22 | ||
|
||
REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on | ||
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial | ||
experiments, perform baseline and negative tests that provide experimental control, make sure | ||
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts. | ||
Do not assume the numbers tell you what you want them to tell. | ||
|
||
Benchmark Mode Cnt Score Error Units | ||
KafkaProducerSinkBenchmark.monixProducer_2P_1RF thrpt 3 19394867.537 ± 53955153.846 ops/s | ||
KafkaProducerSinkBenchmark.monixSink_1P_1RF thrpt 3 15602533.997 ± 25012388.495 ops/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{yyyyMMdd-HH:mm:ss.SSSZ} [%thread] %-5level %logger - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="WARN"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
<logger name="org.apache.kafka" level="WARN"/> | ||
<logger name="org.apache.zookeeper" level="WARN"/> | ||
<logger name="org.I0Itec.zkclient" level="WARN"/> | ||
<logger name="org.apache.kafka.common.utils.AppInfoParser" level="ERROR"/> | ||
<logger name="org.apache.kafka.clients.NetworkClient" level="ERROR"/> | ||
</configuration> |
40 changes: 40 additions & 0 deletions
40
benchmarks/src/main/scala/monix/kafka/benchmarks/KafkaConsumerBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package monix.kafka.benchmarks | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import monix.execution.Scheduler.Implicits.global | ||
import monix.kafka.KafkaConsumerObservable | ||
import org.openjdk.jmh.annotations.{BenchmarkMode, Fork, Measurement, Mode, OutputTimeUnit, Scope, State, Threads, Warmup, _} | ||
|
||
@State(Scope.Thread) | ||
@BenchmarkMode(Array(Mode.Throughput)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@Measurement(iterations = 3) | ||
@Warmup(iterations = 1) | ||
@Fork(2) | ||
@Threads(2) | ||
class KafkaConsumerBenchmark extends KafkaFixture { | ||
|
||
var size: Int = 5 | ||
|
||
produceSinkGrouped(monix_consumer_1P_1RF, size * 2, 5).runSyncUnsafe() | ||
produceSinkGrouped(monix_consumer_2P_1RF, size * 10, 5).runSyncUnsafe() | ||
|
||
//syntax (P, P, RF) === (Parallelism factor, Partitions, Replication Factor) | ||
@Benchmark | ||
def monixSink_1P_1RF(): Unit = { | ||
KafkaConsumerObservable[Integer, Integer](consumerConf, List(monix_consumer_1P_1RF)) | ||
.take(size - 1) | ||
.lastL | ||
.runSyncUnsafe() | ||
} | ||
|
||
@Benchmark | ||
def monixProducer_2P_1RF(): Unit = { | ||
KafkaConsumerObservable[Integer, Integer](consumerConf, List(monix_consumer_2P_1RF)) | ||
.take(size - 1) | ||
.lastL | ||
.runSyncUnsafe() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
benchmarks/src/main/scala/monix/kafka/benchmarks/KafkaProducerSinkBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package monix.kafka.benchmarks | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import org.openjdk.jmh.annotations.{BenchmarkMode, Fork, Measurement, Mode, OutputTimeUnit, Scope, State, Threads, Warmup, _} | ||
|
||
@State(Scope.Thread) | ||
@BenchmarkMode(Array(Mode.Throughput)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@Measurement(iterations = 3) | ||
@Warmup(iterations = 1) | ||
@Fork(1) | ||
@Threads(1) | ||
class KafkaProducerSinkBenchmark extends KafkaFixture { | ||
|
||
var size: Int = 20 | ||
|
||
@Benchmark | ||
def monixSink_1P_1RF(): Unit = | ||
produceSinkGrouped(monix_sink_1P_1RF, size, 5) | ||
|
||
@Benchmark | ||
def monixSink_2P_1RF(): Unit = | ||
produceSinkGrouped(monix_sink_1P_1RF, size, 5) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
benchmarks/src/test/scala/benchmarks/KafkaConsumerSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package benchmarks | ||
|
||
import monix.execution.Scheduler.Implicits.global | ||
import monix.kafka.{KafkaConsumerObservable, KafkaProducer} | ||
import monix.kafka.benchmarks.KafkaFixture | ||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
class KafkaConsumerSpec extends FlatSpec with KafkaFixture with Matchers { | ||
|
||
val producer = KafkaProducer[String, String](producerConf, global) | ||
|
||
s"Monix ${monix_consumer_1P_1RF}" should "exist" in { | ||
val t = producer.send(topic = monix_consumer_1P_1RF, "test") | ||
|
||
t.runSyncUnsafe().isDefined shouldBe true | ||
} | ||
|
||
it should "allow " in { | ||
produceSinkGrouped(monix_consumer_1P_1RF, 20, 5).runSyncUnsafe() | ||
val elements = KafkaConsumerObservable[Integer, Integer](consumerConf, List(monix_consumer_1P_1RF)).take(20).toListL.runSyncUnsafe() | ||
elements.size shouldBe 20 | ||
} | ||
|
||
} |
Oops, something went wrong.