PerfTest压测rabbitmq
rabbitmq官方认可的压测工具是开源的PerfTest,在rabbitmq官网可下载
使用方式:
./runjava com.rabbitmq.perf.PerfTest -h amqp://user:pass@192.168.0.1:5672 -e xxx_exchange -k xxx_route -s 50 -x 2 -y 0 --body-content-type application/json -t topic -p -z 5
id: test-203741-943, starting producer #0
id: test-203741-943, starting producer #0, channel #0
id: test-203741-943, starting producer #1
id: test-203741-943, starting producer #1, channel #0
id: test-203741-943, time: 3.646s, sent: 0.27 msg/s
id: test-203741-943, time: 4.720s, sent: 2642 msg/s
id: test-203741-943, time: 5.794s, sent: 5912 msg/s
id: test-203741-943, time: 6.876s, sent: 33278 msg/s
id: test-203741-943, time: 7.894s, sent: 11594 msg/s
id: test-203741-943, sending rate avg: 6638 msg/s
id: test-203741-943, receiving rate avg: 0 msg/s
参数解释:--help有说明
重点说明的:
-h 这个是uri,需要是rabbitmq uri
-s 50个字节的消息,打开queue里实际上类似:
AABF3gAAvqjqKiOVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-t -p 默认exchange是direct,如果不是必须指定-t否则出错。-p是声明queue是durable持久化的,不加也会出错
其他几个参数很直白不必解释
压测目的:
rabbit能够承载的并发队列长度,大小,等等。通过mq web portal查看效果