Jmeter对RabbitMQ压力测试
Posted rong341233
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jmeter对RabbitMQ压力测试相关的知识,希望对你有一定的参考价值。
Jmeter原生不支持对MQ的消息压测,需要安装AMQP插件
https://github.com/jlavallee/JMeter-Rabbit-AMQP
一.编译JMeter-Rabbit-AMQP插件
1.电脑安装jdk 1.8 (https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html)
2.电脑安装apache-ant (https://dlcdn.apache.org//ant/binaries/apache-ant-1.9.16-bin.zip)
3.下载 RabbitMQ客户端插件amqp-client-3.4.4.jar(https://repo1.maven.org/maven2/com/rabbitmq/amqp-client/3.4.4/amqp-client-3.4.4.jar)到源码目录
3.修改配置文件
(1)修改源码里的build.xml,http改成https
(2)修改build.xml里面ivy.install.version,2.3.0改成2.5.0
4.打包
直接在所在目录,执行ant命令即可
5.复制插件到jmeter目录
(1)把上面下载的amqp-client-3.4.4.jar复制到jmeter安装目录的lib\\ext目录下
(2)把源码目录下target\\dist目录下的JMeterAMQP.jar也复制到lib\\ext目录下
6.启动jmeter的时候就出现了
二.压力测试
1.将文件的内容保存到一个rabbitmq.jmx
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="RPC Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="rabbitmq" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stoptest</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<intProp name="LoopController.loops">-1</intProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">8</stringProp>
<stringProp name="ThreadGroup.ramp_time">15</stringProp>
<longProp name="ThreadGroup.start_time">1361373100000</longProp>
<longProp name="ThreadGroup.end_time">1361373100000</longProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<stringProp name="ThreadGroup.duration">60</stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="Reply-To Queue Name" enabled="true">
<stringProp name="maximumValue">999999999</stringProp>
<stringProp name="minimumValue">1</stringProp>
<stringProp name="outputFormat">000000000</stringProp>
<boolProp name="perThread">false</boolProp>
<stringProp name="randomSeed"></stringProp>
<stringProp name="variableName">replyToQueue</stringProp>
</RandomVariableConfig>
<hashTree/>
<RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="Unique ID" enabled="true">
<stringProp name="variableName">uniqueId</stringProp>
<stringProp name="outputFormat">0000000</stringProp>
<stringProp name="minimumValue">1</stringProp>
<stringProp name="maximumValue">9999999</stringProp>
<stringProp name="randomSeed">3499272</stringProp初学者Jmeter对HTTP请求压力测试并发测试的简单使用