51Testing软件测试论坛

标题: 带你走进RabbitMQ PerfTest 的世界中! [打印本页]

作者: lsekfe    时间: 2022-10-13 14:18
标题: 带你走进RabbitMQ PerfTest 的世界中!
RabbitMQ PerfTest 性能测试工具使用
  参考官方文档点击打开链接
  http://www.rabbitmq.com/java-tools.html#using-perf-test
  一 、下载PerfTest 的源码或者可执行jar包
  https://bintray.com/rabbitmq/java-tools/perf-test
  bin 解压之后,结构如下
[attach]143790[/attach]
将html 目录中的数据:
[attach]143791[/attach]
拷贝到bin目录,并且将example 内容 也拷贝到bin 目录,结果如下:
[attach]143792[/attach]
二 、可用根据你的需要 编写 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 目录

  1. <font size="3">python3.0

  2.   python -m http.server

  3.   python2.0

  4.   python -m SimpleHTTPServer</font>
复制代码
还有个方法:
  1. <font size="3">D:\rabbitmq-perf-test-2.1.2\bin\runjava.bat  com.rabbitmq.perf.WebServer

  2.   runjava.bat com.rabbitmq.perf.WebServer</font>
复制代码
 也可直接查看啥的
  1. <font size="3">
  2.   runjava.bat com.rabbitmq.perf.BenchmarkResults publish-consume-result.js</font>
复制代码
具体参考官方文档
  1. <font size="3"> https://github.com/rabbitmq/rabbitmq-perf-test/blob/master/html/README.md</font>
复制代码
给几个various-spect.js? 和对应 variou.html 例子:
  1. <font size="3"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  2.   <html>

  3.    <head>

  4.       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  5.       <title>RabbitMQ Performance</title>

  6.       <link href="../perf.css" rel="stylesheet" type="text/css">

  7.       <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../lib/excanvas.min.js"></script><![endif]-->

  8.       <script language="javascript" type="text/javascript" src="../lib/jquery.min.js"></script>

  9.       <script language="javascript" type="text/javascript" src="../lib/jquery.flot.min.js"></script>

  10.       <script language="javascript" type="text/javascript" src="../perf.js"></script>

  11.       <script language="javascript" type="text/javascript">

  12.       $(document).ready(function() {

  13.         var main_results;

  14.           $.ajax({

  15.               url: 'various-result.js',

  16.               success: function(data) {

  17.                   render_graphs(JSON.parse(data));

  18.               },

  19.               fail: function() { alert('error loading various-result.js'); }

  20.           });

  21.       });

  22.       </script>

  23.    </head>

  24.       <body>

  25.       <h1>RabbitMQ Performance Various Test Result </h1>

  26.   

  27.    <div class="box">

  28.    <h3>no ack</h3>

  29.     <div class="summary"

  30.     data-scenario="no-ack"

  31.     data-mode="recv" data-name="接收速率"

  32.     ></div>

  33.    </div>

  34.   

  35.   <div class="box">

  36.    <h3>no ack</h3>

  37.     <div class="summary"

  38.     data-scenario="no-ack"

  39.     data-mode="send" data-name="发送速率"

  40.     ></div>

  41.    </div>

  42.   

  43.       <div class="box">

  44.       <h3>Time</h3>

  45.       <div class="chart"

  46.         data-type="time"

  47.         data-x-axis="time(s)"

  48.         data-y-axis=""

  49.         data-scenario="no-ack"></div>

  50.       </div>

  51.       <div class="box">

  52.       <h3>message-sizes-and-producers</h3>

  53.       <div class="chart"

  54.         data-type="series"

  55.         data-scenario="message-sizes-and-producers"

  56.         data-x-key="producerCount"

  57.         data-x-axis="producers"

  58.         data-y-axis="rate (msg/s)"

  59.         data-plot-key="send-msg-rate"

  60.         data-series-key="minMsgSize"></div>

  61.       </div>

  62.       <div class="box">

  63.       <h3>message-sizes-large</h3>

  64.       <div class="chart"

  65.         data-type="x-y"

  66.         data-scenario="message-sizes-large"

  67.         data-x-key="minMsgSize"

  68.         data-plot-keys="send-msg-rate send-bytes-rate"

  69.         data-x-axis="message size (bytes)"

  70.         data-y-axis="rate (msg/s)"

  71.         data-y-axis2="rate (bytes/s)"

  72.         data-legend="ne"></div>

  73.       </div>

  74.       <div class="box">

  75.       <h3>r-l</h3>

  76.       <div class="chart"

  77.         data-type="r-l"

  78.         data-x-axis="rate attempted (msg/s)"

  79.         data-y-axis="rate (msg/s)"

  80.         data-scenario="rate-vs-latency"></div>

  81.       </div>

  82.    </body>

  83.   </html></font>
复制代码
  1. <font size="3"> [ {'name':      'no-ack',  'type':      'simple',   'uri': 'amqp://root:root@192.168.145.129:5672',  'params':    [{'time-limit':     30}]},

  2.    {'name':      'message-sizes-and-producers',

  3.     'type':      'varying',

  4.     'uri': 'amqp://root:root@192.168.145.129:5672',

  5.     'params':    [{'time-limit':     30,

  6.                    'consumer-count': 0}],

  7.     'variables': [{'name':   'min-msg-size',

  8.                    'values': [0, 1000, 10000, 100000]},

  9.                   {'name':   'producer-count',

  10.                    'values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}]},

  11.    {'name':      'message-sizes-large',

  12.     'type':      'varying',

  13.     'uri': 'amqp://root:root@192.168.145.129:5672',

  14.     'params':    [{'time-limit': 30}],

  15.     'variables': [{'name':   'min-msg-size',

  16.                    'values': [5000, 10000, 50000, 100000, 500000, 1000000]}]},

  17.   {'name':      'rate-vs-latency',

  18.     'type':      'rate-vs-latency',

  19.     'uri': 'amqp://root:root@192.168.145.129:5672',

  20.     'params':    [{'time-limit': 30}]}]</font>
复制代码
第二个:
  1. <font size="3"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  2.   <html>

  3.    <head>

  4.       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  5.       <title>RabbitMQ Performance</title>

  6.       <link href="../perf.css" rel="stylesheet" type="text/css">

  7.       <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../lib/excanvas.min.js"></script><![endif]-->

  8.       <script language="javascript" type="text/javascript" src="../lib/jquery.min.js"></script>

  9.       <script language="javascript" type="text/javascript" src="../lib/jquery.flot.min.js"></script>

  10.       <script language="javascript" type="text/javascript" src="../perf.js"></script>

  11.       <script language="javascript" type="text/javascript">

  12.       $(document).ready(function() {

  13.         var main_results;

  14.           $.ajax({

  15.               url: 'various-result.js',

  16.               success: function(data) {

  17.                   render_graphs(JSON.parse(data));

  18.               },

  19.               fail: function() { alert('error loading various-result.js'); }

  20.           });

  21.       });

  22.       </script>

  23.    </head>

  24.       <body>

  25.       <h1>RabbitMQ Performance Various Test Result </h1>

  26.   

  27.       <div class="box">

  28.       <h3>consumers-and-producers</h3>

  29.       <div class="chart"

  30.         data-type="series"

  31.         data-scenario="consumers-and-producers"

  32.         data-x-key="producerCount"

  33.         data-x-axis="producers"

  34.         data-y-axis="send rate (msg/s)"

  35.         data-plot-key="send-msg-rate"

  36.         data-series-key="consumerCount"></div>

  37.       </div>

  38.   

  39.   

  40.   <div class="box">

  41.       <h3>consumers-and-producers</h3>

  42.       <div class="chart"

  43.         data-type="series"

  44.         data-scenario="consumers-and-producers"

  45.         data-x-key="producerCount"

  46.         data-x-axis="producers"

  47.         data-y-axis="recv rate (msg/s)"

  48.         data-plot-key="recv-msg-rate"

  49.         data-series-key="consumerCount"></div>

  50.       </div>

  51.   

  52.   

  53.    </body>

  54.   </html></font>
复制代码
  1. <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']

  2.                  }],

  3.         'variables': [

  4.   {'name':   'consumer-count',

  5.    'values': [1, 2, 3, 4, 5, 6]

  6.   },

  7.   {

  8.    'name':   'producer-count',

  9.    'values': [1, 2, 3, 4, 5, 6]

  10.   }

  11.   ]

  12.    }

  13.   ]</font>
复制代码
第三个:
  1. <font size="3"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  2.   <html>

  3.    <head>

  4.       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  5.       <title>RabbitMQ Performance</title>

  6.       <link href="../perf.css" rel="stylesheet" type="text/css">

  7.       <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../lib/excanvas.min.js"></script><![endif]-->

  8.       <script language="javascript" type="text/javascript" src="../lib/jquery.min.js"></script>

  9.       <script language="javascript" type="text/javascript" src="../lib/jquery.flot.min.js"></script>

  10.       <script language="javascript" type="text/javascript" src="../perf.js"></script>

  11.       <script language="javascript" type="text/javascript">

  12.       $(document).ready(function() {

  13.         var main_results;

  14.           $.ajax({

  15.               url: 'various-result.js',

  16.               success: function(data) {

  17.                   render_graphs(JSON.parse(data));

  18.               },

  19.               fail: function() { alert('error loading various-result.js'); }

  20.           });

  21.       });

  22.       </script></font>
复制代码
  1. <font size="3"></head>

  2.       <body>

  3.       <h1>RabbitMQ Performance Various Test Result </h1>

  4.   

  5.   

  6.       <div class="box">

  7.       <h3>message-sizes-and-consumers</h3>

  8.       <div class="chart"

  9.         data-type="series"

  10.         data-scenario="message-sizes-and-consumers"

  11.         data-x-key="consumerCount"

  12.         data-x-axis="consumers"

  13.         data-y-axis="send rate (msg/s)"

  14.         data-plot-key="send-msg-rate"

  15.         data-series-key="minMsgSize"></div>

  16.       </div>

  17.   

  18.    <div class="box">

  19.       <h3>message-sizes-and-consumers</h3>

  20.       <div class="chart"

  21.         data-type="series"

  22.         data-scenario="message-sizes-and-consumers"

  23.         data-x-key="consumerCount"

  24.         data-x-axis="consumers"

  25.         data-y-axis="recv rate (msg/s)"

  26.         data-plot-key="recv-msg-rate"

  27.         data-series-key="minMsgSize"></div>

  28.       </div>

  29.   

  30.   

  31.   

  32.    </body>

  33.   </html></font>
复制代码
  1. <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']}],

  2.     'variables': [{'name':   'min-msg-size',

  3.                    'values': [0, 1000, 10000, 100000]},

  4.                   {'name':   'consumer-count',

  5.                    'values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}]}

  6.   ]</font>
复制代码
当然还有一个类可用, 命令如下
  1. <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"  

  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

  3.   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>
复制代码








欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2