给一个client.id真实设置1MB/秒的producer_byte_rate配额,对比限速前后的真实吞吐量和延迟变化,看Kafka quota真实是通过什么机制把流量摁住的。
命令 · shell $ kafka-producer-perf-test.sh --topic quota-demo --num-records 200000 --record-size 500 \ --throughput -1 --producer-props client.id=quota-test-client
200000 records sent, 68728.52 records/sec (32.77 MB/sec), 782.53 ms avg latency, 1207.00 ms max latency
命令 · shell $ kafka-configs.sh --alter --entity-type clients --entity-name quota-test-client \ --add-config 'producer_byte_rate=1048576' $ kafka-producer-perf-test.sh --topic quota-demo --num-records 200000 --record-size 500 \ --throughput -1 --producer-props client.id=quota-test-client
200000 records sent, 2159.80 records/sec (1.03 MB/sec), 25943.97 ms avg latency, 34922.00 ms max latency
每一步都是本文上面用kafka-producer-perf-test.sh跑出来的原始结果。