-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into bounded-commit-avai…
…lable
- Loading branch information
Showing
23 changed files
with
1,276 additions
and
590 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
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
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,87 @@ | ||
# Comparison Benchmarks | ||
|
||
## Results | ||
|
||
The benchmark are run from a GitHub action on every commit. The results are published | ||
on https://zio.github.io/zio-kafka/dev/bench/. | ||
|
||
The results are automatically pruned by [a scala script](https://github.com/zio/zio-kafka/blob/gh-pages/scripts/prune-benchmark-history.sc) on the `gh-pages` branch. | ||
|
||
## The consumer benchmarks | ||
|
||
When comparing the zio-kafka benchmarks against the regular Kafka clients, keep in mind that these benchmarks represent | ||
the worst possible case for zio-kafka. This is because these consumers only count the received records, there is no | ||
processing. This makes the comparison look bad for zio-kafka because zio-kafka programs normally process records in | ||
parallel, while other Kafka consumers process records serially. | ||
|
||
All consumer benchmarks send 50k ~512 byte records per run. | ||
|
||
#### zio.kafka.bench.ZioKafkaConsumerBenchmark.throughput | ||
|
||
Uses zio-kafka's `plainStream` with a topic subscription. The offsets of the consumed records are _not_ committed. | ||
|
||
#### zio.kafka.bench.ZioKafkaConsumerBenchmark.throughputWithCommits | ||
|
||
Same as above, but now the offsets of the consumed records are committed. | ||
|
||
#### zio.kafka.bench.comparison.KafkaClientBenchmarks.kafkaClients | ||
|
||
The simplest possible Kafka client that subscribes to a topic. It directly calls the poll method in a tight loop. | ||
|
||
#### zio.kafka.bench.comparison.KafkaClientBenchmarks.manualKafkaClients | ||
|
||
Same as above, but now using partition assignment instead of topic subscription. | ||
|
||
#### zio.kafka.bench.comparison.ZioKafkaBenchmarks.zioKafka | ||
|
||
Does the same as `zio.kafka.bench.ZioKafkaConsumerBenchmark.throughput`. | ||
|
||
#### zio.kafka.bench.comparison.ZioKafkaBenchmarks.manualZioKafka | ||
|
||
Does the same as `zio.kafka.bench.ZioKafkaConsumerBenchmark.throughput`, but uses a partition assignment instead of a | ||
topic subscription. | ||
|
||
## The producer benchmarks | ||
|
||
#### zio.kafka.bench.ZioKafkaProducerBenchmark.produceChunkSeq | ||
|
||
Sequentially produces 30 batches, where each batch contains 500 small records. | ||
|
||
#### zio.kafka.bench.ZioKafkaProducerBenchmark.produceChunkPar | ||
|
||
Produces the same batches as the above, but from 4 fibers. | ||
|
||
#### zio.kafka.bench.ZioKafkaProducerBenchmark.produceSingleRecordSeq | ||
|
||
Sequentially produces 100 small records. | ||
|
||
#### zio.kafka.bench.ZioKafkaProducerBenchmark.produceSingleRecordPar | ||
|
||
Produces 100 small records from 4 fibers. | ||
|
||
## How to run the benchmarks | ||
|
||
To run these "comparison" benchmarks, in a sbt console, run: | ||
|
||
```scala | ||
clean | ||
Test/compile | ||
zioKafkaBench/Jmh/run -wi 10 -i 10 -r 1 -w 1 -t 1 -f 5 -foe true .*comparison.* | ||
``` | ||
|
||
The `.*comparison.*` part is the selector telling to JMH which benchmarks to run. | ||
Here, we're only selecting the ones living in the `comparison` package. | ||
|
||
## Tuning JMH runs | ||
|
||
To list all possible options and understand these configurations, see run `sbt "zioKafkaBench/Jmh/run -h"` | ||
|
||
Used options meaning: | ||
|
||
- "-wi 10": 10 warmup iterations | ||
- "-i 10": 10 benchmark iterations | ||
- "-r 1": Minimum time to spend at each measurement iteration. 1 second | ||
- "-w 1": Minimum time to spend at each warmup iteration. 1 second | ||
- "-t 1": Number of worker threads to run with. 1 thread | ||
- "-f 5": How many times to fork a single benchmark. 5 forks | ||
- "-foe true": Should JMH fail immediately if any benchmark had experienced an unrecoverable error?. True |
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
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
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: 0 additions & 26 deletions
26
zio-kafka-bench/src/main/scala/zio/kafka/bench/comparison/README.md
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.