Skip to content

Instantly share code, notes, and snippets.

@ngocdaothanh
Created August 15, 2012 09:40
Show Gist options
  • Save ngocdaothanh/3358184 to your computer and use it in GitHub Desktop.
Save ngocdaothanh/3358184 to your computer and use it in GitHub Desktop.
WebSocket benchmark with https://github.com/wulczer/tsung_ws
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/home/ngocdaothanh/opt/tsung-ws-plugin/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<!-- Can't be IP -->
<client host="localhost" cpu="8"/>
<client host="t2" cpu="8"/>
<!--
<client host="t3" cpu="8"/>
<client host="t4" cpu="8"/>
<client host="t5" cpu="8"/>
<client host="t6" cpu="8"/>
<client host="t7" cpu="8"/>
<client host="t8" cpu="8"/>
<client host="t9" cpu="8"/>
<client host="t10" cpu="8"/>
-->
</clients>
<servers>
<server host="my_website" port="80" type="tcp"/>
</servers>
<load>
<arrivalphase phase="1" duration="5" unit="minute">
<users arrivalrate="200" unit="second"></users>
</arrivalphase>
</load>
<sessions>
<session probability="100" name="ws" type="ts_websocket">
<request><websocket type="connect" url="/ws/1"/></request>
<request><websocket type="send">sec</websocket></request>
<setdynvars sourcetype="random_number" start="5" end="10"><var name="tt"/></setdynvars>
<thinktime value="%%_tt%%"></thinktime>
<request><websocket type="send" ack="no_ack">play,0</websocket></request>
<for from="1" to="20" incr="1" var="count1">
<setdynvars sourcetype="random_number" start="5" end="15"><var name="tt"/></setdynvars>
<setdynvars sourcetype="random_number" start="1" end="10"><var name="h_count"/></setdynvars>
<thinktime value="%%_tt%%"></thinktime>
<for from="1" to="%%_h_count%%" incr="1" var="count2">
<request><websocket type="send" ack="no_ack">h,0,101</websocket></request>
</for>
</for>
<request><websocket type="close"/></request>
</session>
</sessions>
</tsung>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment