簡體   English   中英

如何使用以Java / scala編寫的自定義應用程序來衡量Kafka性能

[英]How to measure Kafka performance with custom application written in java/scala

我們將kafka用於pub sub,並希望使用kafka測試整個系統的性能。

在kafka世界中是否有任何可用的工具可以模擬多個發布者和訂閱者以考慮自定義應用程序層(域模型消息序列化和反序列化)來衡量延遲和吞吐量?

關於此的任何指導原則會有所幫助嗎?

Kafka包括kafka-producer-perf-testkafka-consumer-perf-test命令,用於計算基准測試(使用Java API)。

用法示例可以在這里看到

用您自己的值在下面進行調整


設定

bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-two --partitions 6 --replication-factor 3

單線程,無復制

bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-one --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=kafka_host:9092 buffer.memory=67108864 batch.size=8196

單線程異步3x復制

bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-two --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=kafka_host:9092 acks=1 buffer.memory=67108864 batch.size=8196

單線程,同步3倍復制

bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-two --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=kafka_host:9092 acks=-1 buffer.memory=67108864 batch.size=8196

郵件大小的影響

for i in 10 100 1000 10000 100000;
do
echo ""
echo $i
bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-two --num-records  $((1000*1024*1024/$i)) --throughput 100000 --record-size $i --producer-props bootstrap.servers=kafka_host:9092 acks=1 buffer.memory=67108864 batch.size=8196
done;

消費者

消費者吞吐量

kafka-consumer-perf-test --broker-list kafka_host:9092 --messages 6000000 --threads 1 --topic test-rep-two --print-metrics

3位消費者

在三台服務器上,運行:

kafka-consumer-perf-test --broker-list kafka_host:9092 --messages 6000000 --threads 1 --topic test-rep-two --print-metrics

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM