我正在尝试为ejabberd
with创建负载测试场景tsung
。
我想模拟来自数千个客户端的数千个 XMPP 事件。根据 tsung 的手册for
,我可以使用循环创建重复动作:
<for from="1" to="10" incr="1" var="counter">
[...]
<request> <http url="/page?id=%%_counter%%"></http> </request>
[...]
</for>
但是这个例子对我不起作用:
alex@alex:~/.tsung$ tsung -f jabber.xml start
Starting Tsung
"Log directory is: /home/alex/.tsung/log/20130417-1404"
3306- fatal: {error,{validity_constraint_Name_Token,37}}
Config Error, aborting ! {fatal,{{error,{validity_constraint_Name_Token,37}},
{file,"jabber.xml"},
{line,10},
{col,29}}}
完整的配置文件:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.5">
<clients>
<client host="localhost" use_controller_vm="true"></client>
</clients>
<!-- Server side setup -->
<servers>
<for from="1" to="1000" incr="1" var="counter">
<server host="t%%_counter%%.testserver.org" port="5222" type="tcp"></server>
</for>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users interarrival="2" unit="second"></users>
</arrivalphase>
</load>
<!-- JABBER parameters -->
<!-- to synchronise users, use a global acknoledgement -->
<options>
<option type="ts_jabber" name="global_number" value="100"></option>
<option type="ts_jabber" name="userid_max" value="10000"></option>
<option type="ts_jabber" name="domain" value="mydomain.org"></option>
<option type="ts_jabber" name="username" value="user"></option>
<option type="ts_jabber" name="passwd" value="pass"></option>
</options>
<sessions>
<session probability="100" name="jabber-loadtest" type="ts_jabber">
<request><jabber type="presence:broadcast" show="online" status="Status: online" ack="no_ack"/></request>
<thinktime value="1"></thinktime>
<request><jabber type="presence:broadcast" show="offline" status="Status: offline" ack="no_ack"/></request>
</session>
</sessions>
</tsung>
如何在tsung
配置文件中使用循环?