TA的每日心情 | 无聊 3 天前 |
---|
签到天数: 1050 天 连续签到: 1 天 [LV.10]测试总司令
|
RabbitMQ PerfTest 性能测试工具使用
参考官方文档点击打开链接
http://www.rabbitmq.com/java-tools.html#using-perf-test
一 、下载PerfTest 的源码或者可执行jar包
https://bintray.com/rabbitmq/java-tools/perf-test
bin 解压之后,结构如下
将html 目录中的数据:
拷贝到bin目录,并且将example 内容 也拷贝到bin 目录,结果如下:
二 、可用根据你的需要 编写 publish-consume-spec.js? 和various.html 两个文件
publish-consume-spec.js? 编写需要测试的参数。
various.html 根据 publish-consume-result.js 的结果 写html? 最后展示。
查看参数说明,完成之后执行runjava.bat com.rabbitmq.perf.PerfTestMulti various-spec.js various-result.js 收集的数据会在 various-result.js中出现。
三、页面展示
http://localhost:8000/various.html
如果需要页面可用打开various.html,可用使用python 开启一个服务
cd 到 bin 目录
- <font size="3">python3.0
- python -m http.server
- python2.0
- python -m SimpleHTTPServer</font>
复制代码 还有个方法:
- <font size="3">D:\rabbitmq-perf-test-2.1.2\bin\runjava.bat com.rabbitmq.perf.WebServer
- runjava.bat com.rabbitmq.perf.WebServer</font>
复制代码 也可直接查看啥的
- <font size="3">
- runjava.bat com.rabbitmq.perf.BenchmarkResults publish-consume-result.js</font>
复制代码 具体参考官方文档
- <font size="3"> https://github.com/rabbitmq/rabbitmq-perf-test/blob/master/html/README.md</font>
复制代码 给几个various-spect.js? 和对应 variou.html 例子:
- <font size="3"> [ {'name': 'no-ack', 'type': 'simple', 'uri': 'amqp://root:root@192.168.145.129:5672', 'params': [{'time-limit': 30}]},
- {'name': 'message-sizes-and-producers',
- 'type': 'varying',
- 'uri': 'amqp://root:root@192.168.145.129:5672',
- 'params': [{'time-limit': 30,
- 'consumer-count': 0}],
- 'variables': [{'name': 'min-msg-size',
- 'values': [0, 1000, 10000, 100000]},
- {'name': 'producer-count',
- 'values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}]},
- {'name': 'message-sizes-large',
- 'type': 'varying',
- 'uri': 'amqp://root:root@192.168.145.129:5672',
- 'params': [{'time-limit': 30}],
- 'variables': [{'name': 'min-msg-size',
- 'values': [5000, 10000, 50000, 100000, 500000, 1000000]}]},
- {'name': 'rate-vs-latency',
- 'type': 'rate-vs-latency',
- 'uri': 'amqp://root:root@192.168.145.129:5672',
- 'params': [{'time-limit': 30}]}]</font>
复制代码 第二个:
- <font size="3"> [ { 'name': 'consumers-and-producers', 'type': 'varying', 'uri': 'amqp://root:root@192.168.145.129:5672', 'params':[{ 'time-limit':30, 'exchange-name':'myexchange', 'queue-names':['myqueue']
- }],
- 'variables': [
- {'name': 'consumer-count',
- 'values': [1, 2, 3, 4, 5, 6]
- },
- {
- 'name': 'producer-count',
- 'values': [1, 2, 3, 4, 5, 6]
- }
- ]
- }
- ]</font>
复制代码 第三个:
- <font size="3"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>RabbitMQ Performance</title>
- <link href="../perf.css" rel="stylesheet" type="text/css">
- <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../lib/excanvas.min.js"></script><![endif]-->
- <script language="javascript" type="text/javascript" src="../lib/jquery.min.js"></script>
- <script language="javascript" type="text/javascript" src="../lib/jquery.flot.min.js"></script>
- <script language="javascript" type="text/javascript" src="../perf.js"></script>
- <script language="javascript" type="text/javascript">
- $(document).ready(function() {
- var main_results;
- $.ajax({
- url: 'various-result.js',
- success: function(data) {
- render_graphs(JSON.parse(data));
- },
- fail: function() { alert('error loading various-result.js'); }
- });
- });
- </script></font>
复制代码- <font size="3"></head>
- <body>
- <h1>RabbitMQ Performance Various Test Result </h1>
-
-
- <div class="box">
- <h3>message-sizes-and-consumers</h3>
- <div class="chart"
- data-type="series"
- data-scenario="message-sizes-and-consumers"
- data-x-key="consumerCount"
- data-x-axis="consumers"
- data-y-axis="send rate (msg/s)"
- data-plot-key="send-msg-rate"
- data-series-key="minMsgSize"></div>
- </div>
-
- <div class="box">
- <h3>message-sizes-and-consumers</h3>
- <div class="chart"
- data-type="series"
- data-scenario="message-sizes-and-consumers"
- data-x-key="consumerCount"
- data-x-axis="consumers"
- data-y-axis="recv rate (msg/s)"
- data-plot-key="recv-msg-rate"
- data-series-key="minMsgSize"></div>
- </div>
-
-
-
- </body>
- </html></font>
复制代码- <font size="3">[ {'name': 'message-sizes-and-consumers', 'type': 'varying', 'uri': 'amqp://root:root@192.168.145.129:5672', 'params': [{'time-limit': 30, 'producer-count': 1, 'exchange-name':'myexchange', 'queue-names':['myqueue']}],
- 'variables': [{'name': 'min-msg-size',
- 'values': [0, 1000, 10000, 100000]},
- {'name': 'consumer-count',
- 'values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}]}
- ]</font>
复制代码 当然还有一个类可用, 命令如下
- <font size="3">runjava.bat com.rabbitmq.perf.PerfTest -h amqp://root:root@192.168.145.129:5672 -x 2 -y 4 -u "throughput-test-2" -a --id "test 2"
- runjava.bat com.rabbitmq.perf.PerfTest -h amqp://root:root@192.168.145.129:5672 -e DIRECT_EX -k CONFIRM_TEST1 -s 50 -x 1 -y 2
- runjava.bat com.rabbitmq.perf.PerfTest -h amqp://root:root@192.168.145.129:5672 -e xxx_exchange -k xxx_route -s 50 -x 2 -y 0 --body-content-type application/json -t topic -p -z 5</font>
复制代码
|
|