通过tsung对openfire进行性能测试,单服基本没有问题,包括客户端cluster,可以进行登录,聊天,Presence改变等等一系列,但是如果针对跨域的非同服情况,貌似就无能为力了,以下是普通的tsung.xml实例:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true"></client>
</clients>
<!-- Server side setup -->
<servers>
<server host="jabber.example.com" port="5225" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users interarrival="0.01" unit="second"></users>
</arrivalphase>
<arrivalphase phase="2" duration="5" unit="minute">
<users interarrival="0.1" unit="second"></users>
</arrivalphase>
<arrivalphase phase="3" duration="3" unit="minute">
<users interarrival="1" unit="second"></users>
</arrivalphase>
</load>
<!-- JABBER parameters -->
<!-- to synchronise users, use a global acknoledgement -->
<options>
<option type="ts_jabber" name="global_number" value="300"></option>
<option type="ts_jabber" name="userid_max" value="500"></option>
<option type="ts_jabber" name="domain"
value="jabber.example.com">
</option>
<option type="ts_jabber" name="username" value="tsung"></option>
<option type="ts_jabber" name="passwd" value="p4ssw0rd"></option>
</options>
<sessions>
<!-- for each user we do the same -->
<session probability="100" name="jabber-example"
type="ts_jabber">
<!-- connect and logon -->
<request>
<jabber type="connect" ack="no_ack"></jabber>
</request>
<thinktime value="2"></thinktime>
<transaction name="authenticate">
<!-- ack=global: wait for all other users to authenticate -->
<request>
<jabber type="auth_get" ack="global"></jabber>
</request>
<request>
<jabber type="auth_set_plain" ack="local"></jabber>
</request>
</transaction>
<request>
<jabber type="presence:initial" ack="no_ack" />
</request>
<thinktime value="2"></thinktime>
<transaction name="roster">
<request>
<jabber type="iq:roster:get" ack="local"></jabber>
</request>
</transaction>
<thinktime value="5"></thinktime>
<transaction name="online">
<request>
<jabber type="chat" ack="no_ack" size="16"
destination="online">
</jabber>
</request>
</transaction>
<!-- add another user to the roster; delete him later -->
<transaction name="rosteradd">
<request>
<jabber type="iq:roster:add" ack="no_ack"
destination="online">
</jabber>
</request>
<request>
<jabber type="presence:subscribe" ack="no_ack" />
</request>
</transaction>
<thinktime value="1"></thinktime>
<!-- write some message to other online and offline (this will cause some errors) users -->
<transaction name="online">
<request>
<jabber type="chat" ack="no_ack" size="56"
destination="online">
</jabber>
</request>
</transaction>
<thinktime value="4"></thinktime>
<transaction name="online">
<request>
<jabber type="chat" ack="no_ack" size="16"
destination="online">
</jabber>
</request>
</transaction>
<transaction name="rosterrename">
<request>
<jabber type="iq:roster:rename" ack="no_ack"></jabber>
</request>
</transaction>
<thinktime value="3"></thinktime>
<transaction name="offline">
<request>
<jabber type="chat" ack="no_ack" size="56"
destination="offline">
</jabber>
</request>
</transaction>
<thinktime value="3"></thinktime>
<transaction name="rosterdelete">
<request>
<jabber type="iq:roster:remove" ack="no_ack"></jabber>
</request>
</transaction>
<!-- and disconnect -->
<transaction name="close">
<request>
<jabber type="close" ack="no_ack"></jabber>
</request>
</transaction>
</session>
</sessions>
</tsung>
2009.08.17添加之疑难解答 :
后来了解到raw type,在tsung用户手册 中有提到:
raw XML
You can send raw XML data to the server using the raw type:
|
Beware: you must encode XML characters like < ,> , & , etc.
又经拦截查看到原始Message体如:
<message to='test3@test7' from='user1@test6/tsung'><body>zhouhui</body> </message>
转化成tsung脚本:
<jabber type="raw" ack="no_ack" data="<message to='test3@test7'><body>zhouhui</body> </message>"></jabber>
经测试成功发送跨域消息。
想想原因一开始就是没了解到有个raw type,都往chat type里钻了
相关链接:http://wwwzhouhui.iteye.com/blog/451298