Skip to content

Instantly share code, notes, and snippets.

@z5ottu
Last active February 24, 2020 18:57
Show Gist options
  • Save z5ottu/11fab3772fe6ce5a9d1c1d9516a0c9d7 to your computer and use it in GitHub Desktop.
Save z5ottu/11fab3772fe6ce5a9d1c1d9516a0c9d7 to your computer and use it in GitHub Desktop.
Tsung emqx mqtt benchmark example with username and password
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="error" version="1.0">
<!-- t1 and t2 host record should be in /etc/hosts file (on t1,t2 machnines too) -->
<clients>
<client host="t1" weight="1" cpu="4" maxusers="51000">
</client>
<client host="t2" weight="1" cpu="4" maxusers="51000">
</client>
</clients>
<servers>
<server host="1.2.3.4" port="1883" type="tcp"></server>
</servers>
<load >
<arrivalphase phase="1" duration="20" unit="second">
<users maxnumber="115000" arrivalrate="5000" unit="second"/>
</arrivalphase>
</load>
<options>
<option name="ports_range" min="1025" max="65535"/>
</options>
<sessions>
<session name="mqtt-example" probability="100" type="ts_mqtt">
<request>
<mqtt type="connect" username="testuser" password="testpassword" clean_start="true" keepalive="60" will_topic="will_topic" will_qos="0" will_msg="will_msg" will_retain="false"></mqtt>
</request>
<request subst="true">
<mqtt type="subscribe" topic="test_topic" qos="1"></mqtt>
</request>
<request>
<mqtt type="waitForMessages" timeout="300"></mqtt>
</request>
<request subst="true">
<mqtt type="unsubscribe" topic="test_topic"></mqtt>
</request>
<request>
<mqtt type="disconnect"></mqtt>
</request>
</session>
</sessions>
</tsung>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment