KAFKA性能测试

KAFKA性能测试,第1张

KAFKA性能测试

KAFKA性能测试
  • 一、生产者性能测试
  • 二、消费者性能测试

Kafka集群提供了一个kafka-producer-perf-test.sh、kafka-consumer-perf-test.sh脚本为生产者消费者提供性能测试,有一系列的参数,我们的性能测试是基于这两个脚本来进行的,分别来测试一下。

一、生产者性能测试
$KAFKA_HOME/bin/kafka-producer-perf-test.sh --topic test666 --record-size 100 --num-records 30000 --throughput 1000 --producer-props bootstrap.servers=hadoop66:9092,hadoop67:9092,hadoop68:9092

各个参数的意义为:

    --topic:主题名
    --record-size:每条消息大小,单位KB
    --num-records:总共发送消息
    --throughput :每秒发送条消息条数

执行完这条命令后,如下图所示:

5002 records sent, 1000.4 records/sec (0.10 MB/sec), 0.7 ms avg latency, 135.0 max latency.
5002 records sent, 1000.2 records/sec (0.10 MB/sec), 0.4 ms avg latency, 21.0 max latency.
5002 records sent, 1000.0 records/sec (0.10 MB/sec), 0.5 ms avg latency, 20.0 max latency.
5001 records sent, 1000.0 records/sec (0.10 MB/sec), 0.5 ms avg latency, 18.0 max latency.
5001 records sent, 1000.0 records/sec (0.10 MB/sec), 0.6 ms avg latency, 28.0 max latency.
30000 records sent, 999.933338 records/sec (0.10 MB/sec), 0.53 ms avg latency, 135.00 ms max latency, 0 ms 50th, 1 ms 95th, 5 ms 99th, 20 ms 99.9th.

本次测试一共发送3w条消息,每秒999.9条,每秒向Kafka写入0.1MB的数据,平均每次写入延迟的时间为0.53ms,最大135ms

二、消费者性能测试
$KAFKA_HOME/bin/kafka-consumer-perf-test.sh --zookeeper hadoop66:2181,hadoop67:2181,hadoop68:2181 --topic test666 --fetch-size 1000 --messages 300000 --threads 1

其中各个参数的意义为:

	--topic:主题
	--zookeeper:zookeeper地址
	--fetch-size:每次消费数据的大小,单位KB
	--messages:一共要消费的总消息数

执行完以后,如下图所示:

start.time, end.time,data.consumed.in.MB,MB.sec, data.consumed.in.nMsg, nMsg.sec
2020-04-24 09:33:19:754, 2020-04-24 09:33:21:294, 4.7684, 3.0963, 50000, 32467.5325

开始时间,结束时间,最大吞吐率(data.consumed.in.MB):4.7684MB/s,平均每秒吞吐率(MB.sec),最大每秒消费(data.consumed.in.nMsg):5000,平均每秒消费(nMsg.sec):32467.5

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5665504.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存