使用TSung对Jabber服务器openfire进行压力测试

14 篇文章 0 订阅

 

我运行TSung的机器装的是Ubuntu 10.04 Server amd64。以下是从安装Tsung到使用Tsung对Openfire进行压力测试的步骤。

1. 下载并安装Tsung.

//安装Erlang及相关组件(必装)
apt-get install erlang erlang-nox erlang-dev erlang-parsetools

//安装生成报表必须的软件
apt-get install perl5 gnuplot libtemplate-perl

//下载Tsung的deb包
wget http://tsung.erlang-projects.org/dist/ubuntu/lucid/tsung_1.4.1-1_all.deb

//安装Tsung
dpkg -i tsung_1.4.1-1_all.deb

2. 配置Tsung

~/.tsung/tsung.xml为tsung默认的配置文件,但我们安装后会发现这个目录和文件并不存在,那就由我们手动来创建这个目录。

mkdir ~/.tsung

在/usr/share/doc/tsung/examples/中有一些示例文件,可以参考jabber_register.xml文件来编写自己的tsung.xml。

cp /usr/share/doc/tsung/examples/jabber_register.xml ~/.tsung/tsung.xml

打开这个文件看一下,做一些修改。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<? xml version = "1.0" ?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
< tsung loglevel = "notice" dumptraffic = "false" version = "1.0" >
 
< clients >
  < client host = "localhost" use_controller_vm = "true" >
  </ client >
  </ clients >
 
< servers >
  < server host = '127.0.0.1' port = '5222' type = 'tcp' />
</ servers >
 
<!-- register 200000 users in less than 15 minutes -->
< load >
  < arrivalphase phase = "1" duration = "15" unit = "minute" >
  < users maxnumber = "200000" interarrival = "0.0025" unit = "second" ></ users >
  </ arrivalphase >
  </ load >
 
< options >
  < option type = "ts_jabber" name = "global_number" value = "5" ></ option >
  < option type = "ts_jabber" name = "userid_max" value = "200000" ></ option >
  < option type = "ts_jabber" name = "domain" value = "erlang-projects.org" ></ option >
  < option type = "ts_jabber" name = "username" value = "tsung" ></ option >
  < option type = "ts_jabber" name = "passwd" value = "tsung" ></ option >
</ options >
 
< sessions >
  < session probability = "100" name = "jabber-example" type = "ts_jabber" >
 
< request >
  < jabber type = "connect" ack = "local" ></ jabber >
  </ request >
 
< request >
  < match do = "abort" when = "match" >error</ match >
  < jabber type = "register" ack = "local" id = "new" ></ jabber >
  </ request >
 
< request >
  < jabber type = "close" ack = "local" ></ jabber >
  </ request >
 
</ session >
</ sessions >
</ tsung >

配置文件中确定好server的host和port,通过<users maxnumber…>来设置要注册的最大用户数即可。

3. 启动Tsung

tsung start/stop/debug/status

运行中,可从openfire的界面上看到不断增加的用户。

4. 生成报表

//进入日志目录
cd ~/.tsung/log/20120728-0511
//运行脚本生成报表文件
/usr/lib/tsung/bin/tsung_stats.pl

5. 查看生成的报表

//安装apache2
apt-get install apache2

//建立符号链接
cd /var/www
ln -s ~/.tsung/log/ tsungreport

这是就可以访问:http://localhost/tsungreport/20120728-0511/report.html来访问报表了。


原文地址:http://zhangxiaodong.me/?p=160

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值