Testing RabbitMQ Production and Consumption Rate
This section describes performance tests on Distributed Message Service (DMS) for RabbitMQ. The performance is measured by the instance flavors, SSL, producer/consumer quantity, queue quantity and type, and exchange type. The tests cover the following scenarios:
- Test scenario 1 (instance flavors): same exchange, queue, number of producers and consumers, but different instance flavors
- Test scenario 2 (whether SSL is enabled): same exchange, queue, number of producers and consumers, instance flavors, but SSL enabled/disabled
- Test scenario 3 (number of producers/consumers): same exchange, queue, instance flavors, but different numbers of producers and consumers
- Test scenario 4 (single-queue and multi-queue): same exchange, number of producers and consumers, instance flavors, but different number of queues
- Test scenario 5 (queue type): same exchange, number of producers and consumers, instance flavors, but different queue types
- Test scenario 6 (fanout exchange): same instance flavors, fanout exchange, number of queues, but different number of producers and consumers
The test result may vary by the network or client conditions.
Test Environment
Perform the following steps to set up the test environment.
- Purchase cluster RabbitMQ 3.8.35 instances with parameters described in Table 1. For details about how to purchase them, see Buying a RabbitMQ Instance.
- You are not advised to set a RabbitMQ password with special characters. If special characters are used, they need to be translated before using test scripts. Otherwise, errors occur.
- Enable public access and allow port 15672 in the inbound rules of the security group when purchasing a rabbitmq-2u4g instance. In this way, the management UI can be accessed in a browser.
Table 1 Instance parameters Name
Brokers
Flavor
SSL Enabled
Disk Type
rabbitmq-ssl
3
rabbitmq.2u4g.cluster
Yes
Ultra-high I/O
rabbitmq-2u4g
3
rabbitmq.2u4g.cluster
No
Ultra-high I/O
rabbitmq-4u8g
3
rabbitmq.4u8g.cluster
No
Ultra-high I/O
rabbitmq-8u16g
3
rabbitmq.8u16g.cluster
No
Ultra-high I/O
rabbitmq-16u32g
3
rabbitmq.16u32g.cluster
No
Ultra-high I/O
Obtain the private connection addresses on the RabbitMQ instance details page and record the username and password. In addition to a rabbitmq-2u4g instance, record the management UI address for later use.
- For the rabbitmq-2u4g instance, log in to the management UI and set queue mirroring, lazy queues, and quorum queues.
- In the / virtual host of the rabbitmq-2u4g instance, create a fanout exchange. For details, see Creating a RabbitMQ Exchange.
- Obtain the test tool rabbitmq-perf-test-2.18.0-bin.tar.gz.
- Purchase a client server.
The region, AZ, VPC, subnet, and security group should be consistent with the RabbitMQ instance. The specification is 16 vCPUs | 32 GB. The server is a Linux ECS. For details, see Purchasing a Custom ECS.
Perform the following operations on the ECSs:
- Install Java JDK and configure the environment variables JAVA_HOME and PATH.
export JAVA_HOME=/root/jdk1.8.0_231 export PATH=$JAVA_HOME/bin:$PATH
- Download rabbitmq-perf-test-2.18.0-bin.tar.gz and decompress it.
tar -zxvf rabbitmq-perf-test-2.18.0-bin.tar.gz
- Install Java JDK and configure the environment variables JAVA_HOME and PATH.
Test Script
- The test script creates a "direct" exchange and a non-persistence queue with automatic deletion enabled. To test fanout exchanges and quorum queues, append "--predeclared" in the script which indicates that custom exchanges and queues are used.
- To test instances with SSL enabled, change "amqp://" to "amqps://" to encrypt data transmission.
Single-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x ${Number of producers} -y ${Number of consumers} -z ${Running time}
Parameter description:
- {Instance username}: username set in 1.
- {Instance password}: password set in 1.
- {Private connection address}: private connection address obtained in 1.
- {Queue name}: queue name.
- {Number of producers}: producer quantity.
- {Number of consumers}: consumer quantity.
- {Running time}: running duration of the script, in seconds.
Multi-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private network connection address} -e ${Exchange name} -s 1024 -x ${ Number of producers} -y ${Number of consumers} -z ${Running time} --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to x
Parameter description:
- {Instance username}: username set in 1.
- {Instance password}: password set in 1.
- {Private connection address}: private connection address obtained in 1.
- {Number of producers}: producer quantity.
- {Number of consumers}: consumer quantity.
- {Running time}: running duration of the script, in seconds.
- queue-%d: indicates multiple queues. The queue name prefix is queue-. %d is a variable ranging from the --queue-pattern-from value to the --queue-pattern-to value, in integers. For example:
--queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to 3: indicates three queues. The queue names are queue-1, queue-2, and queue-3.
Test Procedure
- Log in to the client server and go to the rabbitmq-perf-test-2.18.0/bin directory.
- Run the following script to test and record the production and consumption rates of different instance flavors:
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x 3 -y 3 -z 300
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -u queue-1 -x 3 -y 3 -z 300
- Run the following script to test and record the production and consumption rates of the "rabbitmq-ssl" instance based on the number of producers, consumers, and queues.
Single-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqps://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x ${Number of producers} -y ${Number of consumers} -z 300
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqps://test:******@192.168.0.150:5671 -e exchange-direct -s 1024 -u queue-1 -x 1 -y 1 -z 300
Multi-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqps://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -x 3 -y 3 -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to x
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqps://test:******@192.168.0.150:5671 -e exchange-direct -s 1024 -x 3 -y 3 -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to 3
- Run the following script to test and record the production and consumption rates of the "rabbitmq-2u4g" instance based on the number of producers, consumers, and queues.
Single-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x ${Number of producers} -y ${Number of consumers} -z 300
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -u queue-1 -x 1 -y 1 -z 300
Multi-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -x ${Number of producers} -y ${Number of consumers} -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to x
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -x 3 -y 3 -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to 3
- Run the following script to test and record the number of producers, consumers, queues, and production and consumption rates of the "rabbitmq-2u4g" instance. The queue types are lazy, mirroring, and quorum.
Single-queue test script (excluding quorum queues):
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x ${Number of producers} -y ${Number of consumers} -z 300
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -u queue-1 -x 1 -y 1 -z 300
Multi-queue test script (excluding quorum queues):
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -x ${Number of producers} -y ${Number of consumers} -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to x
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -x 3 -y 3 -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to 3
Single-queue test script (quorum queue):./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x ${Number of producers} -y ${Number of consumers} -z 300 --predeclared
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -u queue-1 -x 1 -y 1 -z 300 --predeclared
Multi-queue test script (quorum queue):
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -x ${Number of producers} -y ${Number of consumers} -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to x --predeclared
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-direct -s 1024 -x 3 -y 3 -z 300 --queue-pattern 'queue-%d' --queue-pattern-from 1 --queue-pattern-to 3 --predeclared
- Run the following script to test and record the production and consumption rates of a fanout exchange of the "rabbitmq-2u4g" instance based on the number of consumers and queues:
Single-queue test script:
./runjava com.rabbitmq.perf.PerfTest -h amqp://${Instance username}:${Instance password}@${Private connection address} -e ${Exchange name} -s 1024 -u ${Queue name} -x ${Number of producers} -y ${Number of consumers} -z 300 --predeclared
Example:
./runjava com.rabbitmq.perf.PerfTest -h amqp://test:******@192.168.0.150:5672 -e exchange-fanout -s 1024 -u queue-1 -x 1 -y 3 -z 300 --predeclared
Test Result
Test scenario 1 (instance flavors): same exchange, queue, number of producers and consumers, but different instance flavors
The test parameters are as follows:
- Exchange: The type is direct, which is not persistent and cannot be automatically deleted.
- Queue: The type is classic. The number of queues is 3. The queue is not persistent and will be automatically deleted.
- Producer: The number is 3.
- Consumer: The number is 3.
Instance Flavor |
Disk Type |
Brokers |
Production Rate |
Consumption Rate |
---|---|---|---|---|
rabbitmq.2u4g.cluster |
Ultra-high I/O |
3 |
32,052 |
25,219 |
rabbitmq.4u8g.cluster |
Ultra-high I/O |
3 |
53,774 |
47,370 |
rabbitmq.8u16g.cluster |
Ultra-high I/O |
3 |
54,727 |
45,730 |
rabbitmq.16u32g.cluster |
Ultra-high I/O |
3 |
66,896 |
51,061 |
Based on the test results, the following conclusions are drawn (for reference only): The bigger the instance flavors, the high the instance performance.
Test scenario 2 (whether SSL is enabled): same exchange, queue, number of producers and consumers, instance flavors, but SSL enabled/disabled
The test parameters are as follows:
- Flavor: rabbitmq.2u4g.cluster × 3.
- Exchange: The type is direct, which is not persistent and cannot be automatically deleted.
- Queue: The type is classic. The queue is not persistent and will be automatically deleted.
SSL Enabled |
Producers |
Consumers |
Queues |
Production Rate |
Consumption Rate |
---|---|---|---|---|---|
Yes |
1 |
1 |
1 |
7,631 |
6,291 |
No |
1 |
1 |
1 |
17,104 |
17,091 |
Yes |
3 |
3 |
1 |
21,819 |
21,819 |
No |
3 |
3 |
1 |
26,050 |
26,050 |
Yes |
6 |
6 |
1 |
19,617 |
19,617 |
No |
6 |
6 |
1 |
24,720 |
24,720 |
Yes |
1 |
3 |
1 |
13,909 |
13,909 |
No |
1 |
3 |
1 |
18,732 |
18,732 |
Yes |
1 |
6 |
1 |
20,006 |
20,006 |
No |
1 |
6 |
1 |
20,371 |
20,371 |
Yes |
3 |
1 |
1 |
7,537 |
5,472 |
No |
3 |
1 |
1 |
28,743 |
28,743 |
Yes |
6 |
1 |
1 |
7,813 |
5,310 |
No |
6 |
1 |
1 |
26,663 |
26,662 |
Yes |
3 |
3 |
3 |
32,052 |
25,219 |
No |
3 |
3 |
3 |
39,951 |
37,790 |
Yes |
3 |
3 |
6 |
32,972 |
26,440 |
No |
3 |
3 |
6 |
38,686 |
37,464 |
Yes |
3 |
3 |
10 |
31,778 |
25,375 |
No |
3 |
3 |
10 |
39,809 |
37,912 |
Based on the test results, the following conclusions are drawn (for reference only): Connecting to a RabbitMQ instance with SSL enabled provides high security, but the production and consumption rates decrease significantly. You are advised to use resources with higher flavors to support the SSL encryption and decryption performance. Increasing the number of producers, consumers, and queues can alleviate the performance deterioration caused by SSL connections.
Test scenario 3 (number of producers/consumers): same exchange, queue, instance flavors, but different numbers of producers and consumers
The test parameters are as follows:
- Flavor: rabbitmq.2u4g.cluster × 3.
- Exchange: The type is direct, which is not persistent and cannot be automatically deleted.
- Queue: The type is classic. The number of queue is 1. The queue is not persistent and will be automatically deleted.
Producers |
Consumers |
Production Rate |
Consumption Rate |
---|---|---|---|
1 |
1 |
17,104 |
17,091 |
3 |
3 |
26,050 |
26,050 |
6 |
6 |
24,720 |
24,720 |
1 |
3 |
18,732 |
18,732 |
1 |
6 |
20,371 |
20,371 |
3 |
1 |
28,743 |
28,743 |
6 |
1 |
26,663 |
26,662 |
Based on the test results, the following conclusions are drawn (for reference only): The bigger the instance flavors, the high the instance performance. In this test, the production rate is the highest when the number of consumer is 1 and producer is 3. When 3 producers are added, the production rate decreases slightly because of performance bottleneck of resources and memory high watermark.
Test scenario 4 (single-queue and multi-queue): same exchange, number of producers and consumers, instance flavors, but different number of queues
The test parameters are as follows:
- Flavor: rabbitmq.2u4g.cluster × 3.
- Exchange: The type is direct, which is not persistent and cannot be automatically deleted.
- Queue: The type is classic. The queue is not persistent and will be automatically deleted.
Producers |
Consumers |
Queues |
Production Rate |
Consumption Rate |
---|---|---|---|---|
3 |
3 |
1 |
26,050 |
26,050 |
3 |
3 |
3 |
39,951 |
37,790 |
3 |
3 |
6 |
38,686 |
37,464 |
3 |
3 |
10 |
39,809 |
37,912 |
6 |
6 |
1 |
24,720 |
24,720 |
6 |
6 |
10 |
54,768 |
45,847 |
Based on the test results, the following conclusions are drawn (for reference only): Given the same number of producers and consumers, the production and consumption rates of multi-queue is higher than those of a single queue. The cause is that the workload among queues is balanced, improving message processing efficiency.
Test scenario 5 (queue type): same exchange, number of producers and consumers, instance flavors, but different queue types
The test parameters are as follows:
- Flavor: rabbitmq.2u4g.cluster × 3.
- Exchange: The type is direct, which is not persistent and cannot be automatically deleted.
- Queue: Classic, lazy, and mirrored queues are set to be non-persistent, and will be automatically deleted. Persistent quorum queues will not be automatically deleted.
Producers |
Consumers |
Queues |
Queue Type |
Production Rate |
Consumption Rate |
---|---|---|---|---|---|
3 |
3 |
1 |
Classic |
26,050 |
26,050 |
3 |
3 |
1 |
Lazy |
12,291 |
12,291 |
3 |
3 |
1 |
Mirrored |
16,513 |
16,100 |
3 |
3 |
1 |
Quorum |
6,771 |
15,568 |
3 |
3 |
10 |
Classic |
39,809 |
37,912 |
3 |
3 |
10 |
Lazy |
30,543 |
29,991 |
3 |
3 |
10 |
Mirrored |
11,130 |
8,220 |
3 |
3 |
10 |
Quorum |
52,466 |
51,772 |
6 |
6 |
1 |
Classic |
24,720 |
24,720 |
6 |
6 |
1 |
Lazy |
9,934 |
8,728 |
6 |
6 |
1 |
Mirrored |
16,000 |
14,888 |
6 |
6 |
1 |
Quorum |
6,318 |
26,841 |
6 |
6 |
10 |
Classic |
54,768 |
45,847 |
6 |
6 |
10 |
Lazy |
42,556 |
33,994 |
6 |
6 |
10 |
Mirrored |
54,625 |
45,853 |
6 |
6 |
10 |
Quorum |
47,133 |
41,011 |
Based on the test results, the following conclusions are drawn (for reference only):
- Lazy queue: The performance of a lazy queue is lower than that of a classic queue. After the queues are added, the performance is significantly improved.
- Mirrored queue: The production rate of a mirrored queue is lower than that of a classic queue. Each time a message is published, the mirrored queue replicates the message to all mirrored nodes, impacting the network transmission and node processing.
- Quorum queue: The consumption rate of a single queue is higher than the production rate. The possible cause is that the quorum queue checks consistency each time data is written, which affects the production rate. The production and consumption rates of multi-queue is significantly higher than those of a single queue. Therefore, multi-queue applies to scenarios requiring high consistency and concurrency.
Test scenario 6 (fanout exchange): same instance flavors, fanout exchange, number of queues, but different number of producers and consumers
The test parameters are as follows:
- Flavor: rabbitmq.2u4g.cluster × 3.
- Exchange: The type is fanout, which is not persistent and cannot be automatically deleted.
- Queue: The type is classic. The number of queue is 1. The queue is not persistent and will be automatically deleted.
Producers |
Consumers |
Production Rate |
Consumption Rate |
---|---|---|---|
1 |
1 |
17,233 |
17,232 |
3 |
3 |
35,539 |
35,231 |
6 |
6 |
32,635 |
31,682 |
1 |
3 |
27,864 |
27,864 |
1 |
6 |
31,518 |
31,518 |
Based on the test results, the following conclusions are drawn (for reference only): The bigger the instance flavors, the high the instance performance.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot