RabbitMQ吞吐量测试-PerfTest上

RabbitMQ吞吐量测试-PerfTest上

PerfTest

RabbitMQ有一个基本的吞吐量测试工具PerfTest(文档,源代码和版本),它基于Java客户端,可以配置为模拟基本工作负载。PerfTest有额外的工具可以生成输出的HTML图形。RabbitMQ集群可能受到很多因素的限制,从基础设施级限制(如网络带宽)到RabbitMQ配置和拓扑到发布和使用的应用程序。PerfTest可以演示节点或节点集群的基准性能。

安装

PerfTest也是从Bintray和 GitHub发布的二进制版本库中分发的 。 如果需要将它作为库,也可以在Maven Central上使用。

Bintray:https://bintray.com/rabbitmq/java-tools/perf-test
GitHub:https://github.com/rabbitmq/rabbitmq-perf-test/releases
Maven Central:http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.rabbitmq%22%20AND%20a%3A%22perf-test%22

要验证PerfTest安装,请使用

bin/runjava com.rabbitmq.perf.PerfTest --help

can@can:/usr/local/mq/rabbitmq_server-3.6.14/rabbitmq-perf-test-2.0.0.RC4$ bin/runjava com.rabbitmq.perf.PerfTest --help
usage: 
 -?,--help                           show usage
 -A,--multi-ack-every           multi ack every
 -a,--autoack                        auto ack
 -ad,--auto-delete              should the queue be auto-deleted,
                                     default is true
 -B,--body                      comma-separated list of files to use
                                     in message bodies
 -b,--heartbeat                 heartbeat interval
 -C,--pmessages                 producer message count
 -c,--confirm                   max unconfirmed publishes
 -ct,--confirm-timeout          waiting timeout for unconfirmed
                                     publishes before failing (in seconds)
 -D,--cmessages                 consumer message count
 -d,--id                        test ID
 -e,--exchange                  exchange name
 -f,--flag                      message flag
 -H,--uris                      connection URIs (separated by commas)
 -h,--uri                       connection URI
 -i,--interval                  sampling interval in seconds
 -K,--random-routing-key             use random routing key per message
 -k,--routing-key               routing key
 -L,--consumer-latency          consumer latency in microseconds
 -l,--legacy-metrics                 display legacy metrics (min/avg/max
                                     latency)
 -M,--framemax                  frame max
 -m,--ptxsize                   producer tx size
 -ms,--use-millis                    should latency be collected in
                                     milliseconds, default is false. Set to true if producers are consumers run
                                     on different machines.
 -n,--ctxsize                   consumer tx size
 -o,--output-file               output file for timing results
 -p,--predeclared                    allow use of predeclared objects
 -Q,--global-qos                channel prefetch count
 -q,--qos                       consumer prefetch count
 -qa,--queue-args               queue arguments as key/pair values,
                                     separated by commas
 -R,--consumer-rate             consumer rate limit
 -r,--rate                      producer rate limit
 -S,--slow-start                     start consumers slowly (1 sec delay
                                     between each)
 -s,--size                      message size in bytes
 -sb,--skip-binding-queues           don't bind queues to the exchange
 -T,--body-content-type         body content-type
 -t,--type                      exchange type
 -u,--queue                     queue name
 -udsc,--use-default-ssl-context     use JVM default SSL context
 -X,--producer-channel-count    channels per producer
 -x,--producers                 producer count
 -Y,--consumer-channel-count    channels per consumer
 -y,--consumers                 consumer count
 -z,--time                      run duration in seconds (unlimited by
                                     default)

使用PerfTest

运行PerfTest的最基本的方法只是指定要连接的URI,要使用的发布者(比如说1)和一些消费者(比如2)。请注意,RabbitMQ Java客户端可以实现较高的发布速率(每个连接每秒高达80至90K条消息),给予足够的带宽,并且当某些安全措施(发行商确认)被禁用时,很少需要过度配置发布者(除非这是特定的测试目标)。

bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "throughput-test-1" -a --id "test 1"
RabbitMQ吞吐量测试-PerfTest上_第1张图片
QQ截图20171211135939.png

使用2个发布者和4个消费者:

bin/runjava com.rabbitmq.perf.PerfTest -x 2 -y 4 -u "throughput-test-2" -a --id "test 2"

此修改将消费者切换到手动确认:

bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "throughput-test-3" --id "test 3"

修改将消息大小从默认(12字节)更改为4 kB:

bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "throughput-test-4" --id "test 4" -s 4000

使用持久队列和持久消息:

bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "throughput-test-5" --id "test-5" -f persistent

你可能感兴趣的:(RabbitMQ吞吐量测试-PerfTest上)