Created
January 11, 2016 05:24
-
-
Save zhangjiayin/81c0ac24a1e8984e046f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE tsung SYSTEM "/opt/local/share/tsung/tsung-1.0.dtd" []> | |
<tsung loglevel="notice" version="1.0" dumptraffic="true"> | |
<!-- Each client that will be running Tsung during the test --> | |
<clients> | |
<client host="localhost" use_controller_vm="true" maxusers="100000" /> | |
</clients> | |
<!-- Each remote server that Tsung should performance test against. Only one would be needed if you have a load balancer. --> | |
<servers> | |
<server host="localhost" port="9093" type="tcp" /> | |
</servers> | |
<!-- Describe how load will be ramped up to your application over time --> | |
<load> | |
<arrivalphase phase="1" duration="120" unit="second"> | |
<users arrivalrate="1000" unit="second" /> | |
</arrivalphase> | |
</load> | |
<!-- Additional testing options --> | |
<options> | |
<option name="websocket_path" value="/socket.io/"/> | |
<!-- How to distribute user-agents among Tsung sessions --> | |
<option type="ts_http" name="user_agent"> | |
<user_agent probability="80">Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21</user_agent> | |
<user_agent probability="20">Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4</user_agent> | |
</option> | |
</options> | |
<sessions> | |
<session name="activity_browse" probability="100" type="ts_http"> | |
<!-- | |
Perform a handshake with Socket.IO. | |
This will return an ID which will uniquely identify this socket with Socket.IO | |
--> | |
<setdynvars sourcetype="eval" code="fun({Pid,DynVars})-> | |
{M, S, _} = os:timestamp(), | |
M * 1000000 + S end."> | |
<var name="timestamp" /> | |
</setdynvars> | |
<setdynvars sourcetype="random_number" start="1" end="10000000"> | |
<var name="userid" /> | |
</setdynvars> | |
<request subst="true"> | |
<!-- | |
<dyn_variable name="websocket_session_id" re="(.*):60:60:websocket,htmlfile,xhr-polling,jsonp-polling" /> | |
--> | |
<dyn_variable name="sid" re="sid":"(\d+)"" /> | |
<http url="/socket.io/?transport=polling&t=%%_timestamp%%000-0&uid=%%_userid%%&authtoken=adfad" method="GET" version="1.1" contents=""></http> | |
</request> | |
<request subst="true"> | |
<!-- | |
<dyn_variable name="websocket_session_id" re="(.*):60:60:websocket,htmlfile,xhr-polling,jsonp-polling" /> | |
--> | |
<http url="/socket.io/?transport=polling&t=%%_timestamp%%000-1&sid=%%_sid%%" method="GET" version="1.1" contents=""></http> | |
</request> | |
<request subst="true"> | |
<!-- | |
<dyn_variable name="websocket_session_id" re="(.*):60:60:websocket,htmlfile,xhr-polling,jsonp-polling" /> | |
--> | |
<http url="/socket.io/?transport=polling&t=%%_timestamp%%000-2&sid=%%_sid%%" method="GET" version="1.1" contents=""></http> | |
</request> | |
<!-- We need to change the session type to websocket --> | |
<change_type new_type="ts_websocket" host="localhost" port="9093" server_type="tcp" restore="true" store="true"/> | |
<!-- Try to connect on a websocket --> | |
<!-- See https://github.com/LearnBoost/socket.io-spec for more information --> | |
<request subst="true"> | |
<websocket type="connect" path="/socket.io/?EIO=3&transport=websocket&sid=%%_sid%%"></websocket> | |
</request> | |
<request> | |
<websocket type="message">1::</websocket> | |
</request> | |
<!-- Do nothing for up to 5 seconds --> | |
<!-- | |
<thinktime value="5" random="true"/> | |
--> | |
<!-- State that we are interested in notifications (this is application specific).--> | |
<!-- | |
<request> | |
<websocket type="message">4:1::{"name":"register-for-feed","args":{"feed": "oae.notifications", "resourceId": "u:cam:eVA584ZTI5", "signature": {"signature": "", "exipires": ""}}}</websocket> | |
</request> | |
--> | |
<!-- Do nothing for up to 5 seconds --> | |
<thinktime value="20" random="true"/> | |
<!-- Close the socket --> | |
<request> | |
<websocket type="close"></websocket> | |
</request> | |
</session> | |
</sessions> | |
</tsung> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment