转自:http://www.cnblogs.com/lingyejun/p/7941271.html

nTsung测试工具的基本测试命令为 Tsung -f  ~/.tsung/mqtt.xml -l <日志保存路径> start

mqtt.xml具体如下(在/usr/share/doc/tsung/examples路径下可查找到):

官网文档: http://tsung.erlang-projects.org/user_manual/conf-client-server.html

TSUNG在服务器上的安装步骤

Tsung压测时总连接数 = 本机可用IP地址数量×本机可用端口的数量×远程服务器可访问IP地址数量×远程服务器可访问端口数量。
yum install -y gcc gcc-c++ make libX11 xauth
yum install -y cairo-devel pango-devel freetype-devel gd-devel
yum install -y ncurses-devel openssl-devel unixODBC-devel wxWidgets-devel wxGTK3-docs mesa-libGL-devel wget http://erlang.org/download/otp_src_20.0.tar.gz
wget https://www.cpan.org/modules/by-module/Template/Template-Toolkit-2.26.tar.gz
wget http://tsung.erlang-projects.org/dist/tsung-1.7.0.tar.gz tar zxf otp_src_20.0.tar.gz
cd otp_src_20.0
./configure --prefix=/usr/local/erlang --without-javac
make -j 2
make install tar zxf gnuplot-4.4.2.tar.gz
cd gnuplot-4.4.2
./configure
make -j 2
make install export PATH=$PATH:/usr/local/erlang/bin/
tar zxf tsung-1.7.0.tar.gz
cd tsung-1.7.0
./configure --prefix=/usr/local/tsung

  

TSUNG的测试脚本

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/tsung/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" version="1.0">
<clients>
<client host="bogon" maxusers="100000" cpu="1">
<ip value="192.168.1.152"></ip>
<ip value="192.168.1.153"></ip>
<ip value="192.168.1.154"></ip>
<ip value="192.168.1.155"></ip>
</client>
</clients> <servers>
<server host="192.168.1.110" port="61613" type="tcp" />
</servers> <load>
<user session="mqtt_subscriber" start_time="30" unit="second"></user>
<arrivalphase phase="1" duration="60" unit="second">
<users maxnumber="100000" arrivalrate="5000" unit="second"/>
</arrivalphase>
</load> <sessions>
<session name="mqtt_publisher" probability="100" type="ts_mqtt">
<request>
<mqtt type="connect" clean_start="true" keepalive="10" username="admin" password="password" will_topic="phihome/test" will_qos="0" will_msg="will_msg" will_retain="false"></mqtt>
</request> <for from="1" to="10" incr="1" var="loops">
<request subst="true">
<mqtt type="publish" topic="phihome/test" qos="1" retained="true">test_message</mqtt>
</request>
</for> <request>
<mqtt type="disconnect"></mqtt>
</request>
</session>
<session name="mqtt_subscriber" probability="0" type="ts_mqtt">
<request>
<mqtt type="connect" clean_start="true" keepalive="10"></mqtt>
</request> <request subst="true">
<mqtt type="subscribe" topic="test_topic" qos="1"></mqtt>
</request> <request>
<!-- wait for 60s -->
<mqtt type="waitForMessages" timeout="60"></mqtt>
</request> <request subst="true">
<mqtt type="unsubscribe" topic="test_topic"></mqtt>
</request> <request>
<mqtt type="disconnect"></mqtt>
</request>
</session>
</sessions>
</tsung>

测试结果总览

注:单台Tsung压测官网纯净版mosquitto(单台Broker),峰值时连接数为197626,后续有追加了另外一台tsung,一共两台机器一起压。

单台最大峰值时的连接数截图:

两台最大峰值时的连接数截图:

转MQTT压力测试之Tsung的使用的更多相关文章

  1. MQTT压力测试之Tsung的使用

    简介 Tsung 是一个压力测试工具,可以测试包括HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and XMPP/Jabber等服务器.针对 HTTP 测试,Tsung ...

  2. MQTT压力测试工具之JMeter插件教程

    基于Jmeter的MQTT测试插件-上 1. Jmeter插件简介 Apache JMeter是Apache组织开发的基于Java的压力测试工具.下载 用于对软件做压力测试,它最初被设计用于Web应用 ...

  3. 压力测试之badboy和Jmeter的简单使用方法

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 所谓压力测试是指,通过确定一个系统的瓶颈或者不能接收的性能点, ...

  4. Android自动化压力测试之Monkey Test (三)

    Monkey 是什么? Monkey是Google提供的一个用于稳定性与压力测试的命令行工具. Monkey路径: 路径:/System/framework/monkey.jar 启动脚本路径:/sy ...

  5. CentOS服务器Http压力测试之ab

    ab的全称是Apache Bench,是Apache自带的网络压力测试工具,相比于LR.JMeter,是我所知道的 Http 压力测试工具中最简单.最通用的. ab命令对发出负载的计算机要求很低,不会 ...

  6. 压力测试之apache benchmark

    ab 的全称是 ApacheBench , 是 Apache 附带的一个小工具 , 专门用于 HTTP Server 的 benchmark testing , 可以同时模拟多个并发请求.前段时间看到 ...

  7. Web性能压力测试之Webbench使用详解

    Webbench是知名的网站压力测试工具,它是由Lionbridge公司(http://www.lionbridge.com)开发.Webbench能测试处在相同硬件上,不同服务的性能以及不同硬件上同 ...

  8. 网站压力测试之ApacheBench

    ApacheBench是 Apache 附带的一个小工具,专门用于 HTTP Server 的benchmark testing,可以同时模拟多个并发请求.使用yum安装apache,ab工具在/us ...

  9. LoadRunner压力测试之Unique Number参数类型、Random Number参数类型浅析

    前几天工作需要用LoadRunner进行压力测试,期间对手机号进行参数化设置. 当时选用了<Value>137{Random_quhao}{Unique_weiyi}</Value& ...

随机推荐

  1. 面试&笔试---c语言之字符串处理

    1.字串拷贝库函数strcpy 函数介绍: 原型声明:extern char *strcpy(char *dest,const char *src); 头文件:string.h 功能:把从src地址开 ...

  2. Caused by: java.net.UnknownHostException: localhost.localdomain: localhost.localdomain的问题解决

    在hosts文件增加如下配置即可,下面的方法适合上面提示的错误,无论是Tomcat问题还是MongoDB等等的问题都可以完美解决. vi /etc/hosts 127.0.0.1 localhost ...

  3. [Clojure] A Room-Escape game, playing with telnet and pure-text commands - Part 1

    Code path: https://github.com/bluesilence/Lisp/tree/master/clojure/projects/room-escape As I have be ...

  4. easyui select 下拉框的取值和赋值

    1.取值 //拍卖管理中示例 function serializeForm(form) { var obj = { auclotType : $('#auclotType').val(), goods ...

  5. JAVA Selenium PHONCOMJS 获取js动态生成完整网页

    首先需要在maven的pom.xml中包含以下依赖 <dependency> <groupId>com.github.detro</groupId> <art ...

  6. 数学图形(1.25)cassini曲线

    通过这种曲线可以看到一种由8到0的过度 相关软件参见:数学图形可视化工具,使用自己定义语法的脚本代码生成数学图形.该软件免费开源.QQ交流群: 367752815 #http://www.mathcu ...

  7. RecyclerView.ItemDecoration 间隔线

    内容已更新到:https://www.cnblogs.com/baiqiantao/p/19762fb101659e8f4c1cea53e7acb446.html 目录一个通用分割线ItemDecor ...

  8. 盒模型中的div居中

    说到居中的问题,或许大多数童鞋都会想到text-align:center; margin:0 auto; vertical-align:middle; line-height:height; ……的确 ...

  9. SQL Server更改排序规则的实现过程

    摘自: http://www.2cto.com/database/201112/115138.html 以下的文章主要向大家描述的是SQL Server更改排序规则的实现过程,以及在实现其实际操作过程 ...

  10. k-means聚类学习

    4.1.摘要 在前面的文章中,介绍了三种常见的分类算法.分类作为一种监督学习方法,要求必须事先明确知道各个类别的信息,并且断言所有待分类项都有一个类别与之对应.但是很多时候上述条件得不到满足,尤其是在 ...