小言_互联网的博客

kafka自带压测工具简单案例解析

338人阅读  评论(0)

根据压测结果可以判断当前kafka部署环境是否满足业务需求、需要做哪方面的优化。
在kafka安装bin目录下有如下两个工具用于针对生产/消费端的压测:
kafka-consumer-perf-test.sh
kafka-producer-perf-test.sh
生产者端
根据kafka处理数据峰值为参照进行测试。

/usr/SFT/kafka-0.11/bin/kafka-producer-perf-test.sh  --topic test --record-size 100 --num-records 100000 --throughput 1000 --producer-props bootstrap.servers=chdp11:9092,chdp12:9092,chdp13:9092

参数解释:
record-size:message size in bytes. Note that you must provide exactly one of --record-size or --payload-file.
num-records:: total number of messages to produce
throughput:throttle maximum message throughput to approximately THROUGHPUT messages/sec

消费者端
根据kafka对接数据下游的业务组件数据处理能力,需要下游的数据处理吞吐量大于kafka的数据发送,若数据发送与处理速率不匹配会出现不必要的问题(如下游数据处理小于kafka数据发送会导致数据延迟增高)

/usr/SFT/kafka-0.11/bin/kafka-consumer-perf-test.sh --zookeeper chdp11:2181 --topic test --fetch-size 10000 --messages 10000000 --threads 1

参数解释:
–fetch-size : The amount of data to fetch in a single request. (default: 1048576)
–messages :REQUIRED: The number of messages to send or consume
–threads :Number of processing threads.


转载:https://blog.csdn.net/qq_34901049/article/details/102080197
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场