Tsung测试openfire服务器
环境准备
安装Tsung、安装openfire、安装Spark
Tsung使用
要对openfire进行压力测试,因此我们主要讲解如何利用jabber_register.xml在openfire上面注册用户,以及利用jabber.xml模拟用户登录openfire上线、离开、会话操作的压力测试
一、注册用户
1、执行以下命令进入到安装目录下的examples目录:
[root@localhost ~]# cd /usr/local/tsung/share/doc/tsung/examples/
[root@localhost examples]# ll
total 64
-rw-r--r--. 1 root root 3834 Mar 7 03:09 fs-nfs.xml
-rw-r--r--. 1 root root 6391 Mar 7 03:09 http_distributed.xml
-rw-r--r--. 1 root root 2609 Mar 7 03:09 http_setdynvars.xml
-rw-r--r--. 1 root root 2215 Mar 7 03:09 http_simple.xml
-rw-r--r--. 1 root root 3140 Mar 7 03:09 jabber_muc.xml
-rw-r--r--. 1 root root 1727 Mar 7 03:09 jabber_privacy.xml
-rw-r--r--. 1 root root 1332 Mar 7 03:09 jabber_register.xml
-rw-r--r--. 1 root root 2762 Mar 7 03:09 jabber_roster.xml
-rw-r--r--. 1 root root 4225 Mar 7 03:09 jabber.xml
-rw-r--r--. 1 root root 2506 Mar 7 03:09 ldap.xml
-rw-r--r--. 1 root root 1148 Mar 7 03:09 mysql.xml
-rw-r--r--. 1 root root 1833 Mar 7 03:09 pgsql.xml
-rw-r--r--. 1 root root 1211 Mar 7 03:09 thinks2.xml
-rw-r--r--. 1 root root 1221 Mar 7 03:09 thinks.xml
2、修改jabber_register.xml文件
3、将修改后的jabber_register.xml放到/usr/local/tsung目录下
再进入tsung的bin目录下,找到tsung执行的shell脚本文件
[root@localhost examples]# cp jabber_register.xml /usr/local/tsung
[root@localhost examples]# cd /usr/local/tsung/bin
[root@localhost bin]#
4、执行tsung脚本以驱动执行我们修改好的jabber_register.xml脚本,实现向openfire添加用户
[root@localhost bin]# ./tsung -f /usr/local/tsung/jabber_register.xml start
Starting Tsung
"Log directory is: /root/.tsung/log/20150311-2253"
5、查看openfire
二、登陆用户模拟发送消息
利用jabber.xml模拟用户登录openfire后执行上线、离开、忙碌、下线、发送消息等操作
1、修改jabber.xml文件(存储路径/usr/local/tsung/share/doc/tsung/examples/)
1)模拟用户上线、下线、发送消息的操作时jabber.xml配置如下:
- 模拟上线与发消息脚本:
<transaction name="online">
<request> <jabber type="chat" ack="no_ack" size="16" destination="online"></jabber> </request>
<request>
<jabber type="raw" ack="no_ack" data="<message to='admin@myopenfire'><body>zhouhui</body> </message>"></jabber>
</request>
</transaction>
- 模拟下线脚本:
<thinktime value="30"></thinktime> <transaction name="offline">
<request> <jabber type="chat" ack="no_ack" size="56" destination="offline"></jabber> </request>
<request>
<jabber type="raw" ack="no_ack" data="<message to='admin@myopenfire'><body>zhouhui</body> </message>"></jabber>
</request>
</transaction>
2)模拟用户含有可聊天、离开、忙碌状态时jabber.xml配置如下:
- 模拟空闲,可聊天状态脚本:
<transaction name="chat">
<request>
<jabber type="presence:broadcast" show="chat" status="Avaliable to chat!" ack="no_ack"/>
</request>
</transaction>
- 模拟离开状态脚本:
<transaction name="away">
<request>
<jabber type="presence:broadcast" show="away" status="Be right back ..." ack="no_ack"/>
</request>
</transaction>
- 模拟请勿打扰状态脚本:
<transaction name="dnd">
<request>
<jabber type="presence:broadcast" show="dnd" status="Don't bother me!" ack="no_ack"/>
</request>
</transaction>
2、将修改后的jabber.xml放到/usr/local/tsung目录下
[root@localhost examples]# cp jabber.xml /usr/local/tsung
[root@localhost examples]# cd /usr/local/tsung/bin
[root@localhost bin]#
3、 执行jabber.xml模拟用户上线、下线、发送消息等操作
[root@localhost bin]# ./tsung -f /usr/local/tsung/jabber.xml start
Starting Tsung
"Log directory is: /root/.tsung/log/20150311-2331"
4、查看用户状态(登录openfire查看或者登录spark查看)
若要查看是否成功发送消息则要使用spark聊天工具(可以去openfire官网下载)
1)登录openfire查看:
2)登录spark聊天工具查看
若使用spark查看其他人员状态时,必须人员双方相互注册为好友才能看到对方的状态变化,若仅验证消息接收,则无需注册好友
如:查看好友状态
三、生成报表
启动Tsung后,Tsung会输出log的存放路径
Starting Tsung
"Log directory is: /root/.tsung/log/20150311-2256"
1、等待测试完毕,进入log目录(只有输出了log日志才会自动log目录,默认路径:/root/.tsung/log)
生成统计图表
[root@localhost bin]# cd /root/.tsung/log/20150311-2256
[root@localhost 20150311-2256]# /usr/local/tsung/lib/tsung/bin/tsung_stats.pl
creating subdirectory data
creating subdirectory gnuplot_scripts
creating subdirectory images
warn, last interval (2) not equal to the first, use the first one (10)
No data for Event
No data for Async
No data for Errors
注意:一定要先进入log目录,才能生成统计图表。
2、查看统计图表
使用xftp工具,将/root/.tsung/log/20150311-2256目录下的统计图表文件report.html下载到本地的Windows操作系统上进行查看。
用IE或firefox等浏览器打开产生的html文件,就能查看本次测试的结果(参数含义见后面说明):
四、遇到的问题
1、 配置文件如果有问题或者运行中间强行关闭的情况下,有时会出现进程未关闭的情况,下次运行会出错,使用下面的命令看是否有未杀死的进程。
[root@localhost bin]# ps aux | grep erlang
root 25161 0.0 0.0 10828 428 ? S Mar10 0:00 /usr/local/erlang/lib/erlang/erts-5.8.5/bin/epmd -daemon
root 27451 0.0 0.0 103240 868 pts/0 S+ 01:05 0:00 grep erlang
Tsung测试openfire服务器的更多相关文章
- 用tsung测试openfire 服务器性能
最近公司需要做一个有聊天功能的应用,客户讲的是很宏大,用户超多,以前搞过openfire,但没有深入的去了解,就想用它来搞,而且是用 java写的,想扩展也容易些,但在性能上一直担忧,想测试一下它的性 ...
- (转)基于即时通信和LBS技术的位置感知服务(三):搭建Openfire服务器+测试2款IM客户端
主要包含4个章节: 1. Java 领域的即时通信的解决方案 2. 搭建 Openfire 服务器 3. 使用客户端测试我们搭建的 Openfire 服务器 4. Smack 和 ASmack 一.J ...
- tsung 对 openfire 压力测试
tsung 对 openfire 压力测试 1. 参考 http://blog.csdn.net/foxisme2/article/details/7521139 http://blog.csdn ...
- Tsung测试Tigase
用两台主机坐Tigase的Tsung测试,其中1台运行Tigase,另1台运行Tsung. 1.Tigase服务器设置 tigase.conf: #osgiEnabled=(true|false) # ...
- iOS - XMPP Openfire 服务器的搭建
前言 提前下载好相关软件,且安装目录最好安装在全英文路径下.如果路径有中文名,那么可能会出现一些莫名其妙的问题. 提前准备好的软件: jdk-8u91-macosx-x64.dmg mysql-5.7 ...
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
在文章开始,请你了解和熟悉openfire方面的相关知识,这样对你理解下面代码以及下面代码的用途有很好的了解.同时,你可能需要安装一个简单的CS聊天工具,来测试你的代码是否成功的在openfire服务 ...
- JMeter测试TCP服务器遇到的一个奇怪问题
今天工作需要测TCP服务器的压力,因为tsung测试TCP需要写的脚本实在头大,于是换了JMETER来搞压力测试.在实际测试的过程中,遇到了一个很奇怪的问题,就是发了数据包以后,JMeter不停地报5 ...
- 基于XMPP协议(openfire服务器)的消息推送实现
转自:http://blog.csdn.net/nomousewch/article/details/8088277 最近好像有不少朋友关注Android客户端消息推送的实现,我在之前的项目中用到过J ...
- ios即时通讯客户端开发之-mac上搭建openfire服务器
一.下载并安装openfire 1.到http://www.igniterealtime.org/downloads/index.jsp下载最新openfire for mac版 比如:Openfir ...
随机推荐
- java微信开发(wechat4j)——wechat4j配置文件解读
wechat4j的配置文件是wechat4j.properties.需要放置在项目src目录下.在wechat4j.jar中的META-INF下有一个wechat4j.properties.sampl ...
- css权重是什么
css权重是什么? 概述 css Specificity中文一般译为css优先级.css权重.相比"权重","优先级"更好理解,mozilla官方中文文档就翻译 ...
- iOS 获取UIView所在的VIewController
写程序的时候我们经常要封装代码,当你封装了一个UIView的子类里需要调用所在ViewController的方法用如下代码调取所在的VIewController #pragma mark - 获取所在 ...
- UI界面的一些简单控件
虽然都是代码 , 但是基本都有注释. #import "ViewController.h" @interface ViewController () /** * 创建视图 */ @ ...
- iOS之UI--辉光动画
前言:学习来自YouXianMing老师的博客:<辉光UIView的category>以及YouXianMing老师的github源码:< GlowView > 而我个人 ...
- Swift 中的函数(下)
学习来自<极客学院:Swift中的函数> 工具:Xcode6.4 直接上基础的示例代码,多敲多体会就会有收获:百看不如一敲,一敲就会 import Foundation /******** ...
- 浅谈 sql 中数据的约束
数据约束 --对用户操作表的数据进行约束 1.默认值 --当用户对使用默认值的字段不插入值的时候,就使用默认值 1)对默认值字段插入null是可以的. 2)对默认值字段可以插入非null [例如:ad ...
- 有关RDS上只读实例延时分析-同适用于自建MySQL主从延时分析判断
个人不是很喜欢在技术上跟人互喷,尤其是不在同一个岗位上的人.一方面本人的性格如此,另一方面,我自身的口水也确实是不行,人生经历了第一次的双11洗礼,在大促的环境下,总算知道了有些东西是否应该规避,这次 ...
- Web开发须知:URL编码与解码
通常如果一样东西需要编码,说明这样东西并不适合传输.原因多种多样,如Size过大,包含隐私数据,对于Url来说,之所以要进行编码,是因为Url中有些字符会引起歧义. 例如,Url参数字符串中使用key ...
- css shorthand属性简写
一.什么是shorthand 属性简写(shorthand)就是一次性声明一组相关的属性.好处呢当然是众所周知的,让css从臃肿无序升级为简洁有效具有高可读性. 大多数的人都使用属性简写,我也用,但是 ...