Benchmark
Java Tools
Install: RabbitMQ PerfTest
Usage
- --time: Seconds, 程式運行時間
- --rate: msg/s, Producer/Consumer 的 Msg Rate
- --consumer-rate: msg/s, Consumer 的 Msg Rate
#> alternatives --list
libnssckbi.so.x86_64 auto /usr/lib64/pkcs11/p11-kit-trust.so
ld auto /usr/bin/ld.bfd
mta auto /usr/sbin/sendmail.postfix
ksh auto /bin/ksh93
java manual /usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64/bin/java
jre_openjdk auto /usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64
jre_11 auto /usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64
jre_11_openjdk auto /usr/lib/jvm/jre-11-openjdk-11.0.8.10-1.el7.x86_64
#> export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64
#> cd rabbitmq-perf-test-2.18.0
#> bin/runjava com.rabbitmq.perf.PerfTest --help
Scenario #1
- Condition:
- Queue: 200
- Producer: 200
- Consumer: 200
- Message Size: 20KB
- Message Rate: 20/s
- Ack Mode: Manual
- Throughput:
- Publish: 4000/s
- Consumer: 4000/s
- Resource:
- CPU (2 Core): 110 %
- Memory (4 GB): 8.8 %
bin/runjava com.rabbitmq.perf.PerfTest --uri amqp://<username>:<password>@<rabbitmq-server-ip>:<port>/<vhost> \
--queue-pattern 'perf-test-%d' \
--queue-pattern-from 1 \
--queue-pattern-to 200 \
--producers 200 \
--consumers 200 \
--size 20000 \
--rate 20
Scenario #2 for the Cluster with 3 nodes
Queue Type: Classic
bin/runjava com.rabbitmq.perf.PerfTest \
--uris "amqp://<username>:<password>@<rabbitmq-server1-ip>:<port>/<vhost>,amqp://<username>:<password>@<rabbitmq-server2-ip>:<port>/<vhost>,amqp://<username>:<password>@<rabbitmq-server3-ip>:<port>/<vhost>" \
--queue-pattern 'perf-test-%d' \
--queue-pattern-from 1 \
--queue-pattern-to 200 \
--producers 200 \
--consumers 200 \
--size 20000 --rate 20
Queue Type: Quorum
bin/runjava com.rabbitmq.perf.PerfTest \
--uris "amqp://<username>:<password>@<rabbitmq-server1-ip>:<port>/<vhost>,amqp://<username>:<password>@<rabbitmq-server2-ip>:<port>/<vhost>,amqp://<username>:<password>@<rabbitmq-server3-ip>:<port>/<vhost>" \
--queue-args x-queue-type=quorum \
--auto-delete false \
--flag persistent \
--queue-pattern 'perf-test-quorum-%d' \
--queue-pattern-from 1 \
--queue-pattern-to 200 \
--producers 200 \
--consumers 200 \
--size 20000 \
--rate 6
效能優化與影響
- 效能影響因素: How to Run Benchmarks | RabbitMQ - Blog
- 13 Common RabbitMQ Mistakes and How to Avoid Them - CloudAMQP
- Cluster Sizing and Other Considerations | RabbitMQ - Blog