Tsung is another open source tool written in erlang. Tsung can be used to load test on multiple protocols, including HTTP, LDAP, PostgreSQL and Jabber/XMPP servers.
Tsung can be used to simulate real users and log them all in simultaneously, stress testing the scalability of your servers. For XMPP Tsung can test authentication, logins, chats, requests and much more.
Refer to http://tsung.erlang-projects.org/ for full details.
For initial install load Tsung on one client machine using the instructions below. The same tsung test can be run from multiple clients simultaneously in order to offer maximum stress testing.
1. wget http://tsung.erlang-projects.org/dist/tsung-1.3.3.tar.gz
2. extract the contents, e.g. to usr/local/share/tsung on ubuntu
3. run ./configure from inside the the tsung-1.3.3 folder
then make
make install
4. Run tsung from command prompt, the following should be displayed:
Usage: tsung
Options:
-f
-l
-i
-r
-s enable erlang smp on client nodes
-F use long names (FQDN) for erlang nodes
-v print version information and exit
-h display this help and exit
You can simulate logins in a number of different way; for my benchmark test I initially created thousands of users within ejabberd using the following script:
for i in `seq 1 10000`; do echo $i && ejabberdctl register test$i servername password$i; done
This created 10000 users from test1 to test10000 with respective passwords.
These users can then be simulated by modifying the tsung.xml file usually located in ~/.tsung . Sample files for different test purposes are available at /usr/local/share/doc/tsung/examples/ .
Configure this file to match whatever benchmarking criteria you require; whether it be load progressions or test duration, all these values can be specified here.
Full explanation of file structure is available in the tsung user manual.
The file I used is similar to those in the samples, it made all users appear online simultaneously.
Some snippets from the tsung.xml file I used:
<clients>
<client host="localhost" use_controller_vm="true" maxusers="100000"></client>
</clients>
<servers>
<server host="serverIP" port="5222" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users maxnumber="10000" interarrival="0.001" unit="second"></users>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="global_number" value="10000"></option>
<option type="ts_jabber" name="userid_max" value="100000"></option>
<option type="ts_jabber" name="domain" value="server domain"></option>
<option type="ts_jabber" name="username" value="test"></option>
<option type="ts_jabber" name="passwd" value="password"></option>
</options>
<sessions>
<session probability="100" name="jabber-example" type="ts_jabber"
<request>
<jabber type="connect" ack="local"></jabber>
</request>
<thinktime value="2"></thinktime>
<transaction name="authenticate">
<request> <jabber type="auth_get" ack="local"></jabber></request>
<request> <jabber type="auth_set_plain" ack="local"></jabber></request>
</transaction>
<request>
<jabber type="presence:initial" ack="global"></jabber></request>
<thinktime value="6000"></thinktime>
<transaction name="close">
<request> <jabber type="close" ack="local"></jabber></request>
</transaction>
</session>
</sessions>
</tsung>
</tsung>
To run the test execute tsung -f tsung.xml start . Ensuring tsung.xml points to your own configuration file.
N.B If you are testing large number of users you need to look at changing max values in /opt/ejabberd/conf/ejabberdctl.cfg on the server instance. There are a number of options that can be set here, the file explains what each value does.
See results and witness logons by accessing http://MYSERVER:5280/admin and viewing log files in ~/.tsung/log
Refer to Tsung User manual for full usage
Support posts and archives http://lists.jabber.ru/pipermail/ejabberd/
Hi Lee,
ReplyDeletethanks a lot for this interesting post. Would it be possible to publish the entire tsung.xml file? Would be great!
Cheers
could you please upload the tsung.xml file aswell
ReplyDeleteHi Guys,
ReplyDeleteIt's been a while since I've posted this. I will see if I can dig out the relevant files and upload them.
hi there
ReplyDeletei want to test and benchmark my HTTP and XMPP server and compare the two results.
do you have xml files and howto of HTTP v/s XMPP servers?
Hi,
ReplyDeleteAre you aware of any tool to load test xmpp with TLS.I do not think tsung as starttls support.
yeah, I agree with you.
DeleteAll I ever see of tsung tutorials are snippets of configuration files, but I can't ever see what a complete, typical config file looks like...not even in their documentation.
ReplyDeleteExactly, I was searching for a xmpp chat code snippet
DeleteThis helped me:
ReplyDeletehttp://tsung.readthedocs.io/en/latest/benchmark.html#jabber-xmpp