Tsung is an open source, a stress testing tool for Erlang that can test servers including HTTP, WebDAV, Mysql, PostgreSQL, LDAP, and Xmpp/jabber. For HTTP testing, Tsung supports HTTP 1.0/1.1,
Includes a proxy mode for session logging, support for GET, POST and PUT, and DELETE methods, support for cookies and basic WWW authentication, and support for SSL.
Download Reference Tsung official website: http://tsung.erlang-projects.org/
Tsung must first install Erlang
1. Installing Erlang
- sudo apt-get install Erlang erlang-src gnuplot perl5
2. Verify that Erlang is installed successfully
Erl
- Erlang R17B01
- (erts-5.7.4) [Source] [64-bit] [Smp:2:2] [Rq:2] [async-threads:0] [HiPe] [Kernel-pool:false]
- Eshell V5.7.4 (abort with ^g)
4. Go to the destination file download path
- Cd/opt/apps
5. Download the Tsung installation package
wget http://tsung.erlang-projects.org/dist/tsung-1.5.1.tar.gz
6. Unzip the installation package
- chmod 777 Tsung-1.5.1.tar.gz
- Tar zxvf tsung-1.5.1.tar.gz
7. Compiling the installation
- CD TSUNG-1.5.1/
- ./configure Tsung
- Make
entering tsung-v on the command line displays the version number Tsung versions 1.5.1, indicating that the installation was successful
Error during installation: "Build main app Boot script ... make: * * * [Priv/tsung.boot] Error 1"
This is due to the low version of Erlang, which can be updated under the Erlang version.
establishing a configuration file for a server
The default configuration file exists in ~/.tsung/tsung.xml, and students who are unfamiliar with the command line can use Ctrl+h to display the hidden folder.
Copy the configuration that needs to be tested from the sample configuration/tsung/examples/jabber_register.xml
The sample configuration code is as follows:
<?xml version= "1.0"?>
<! DOCTYPE Tsung SYSTEM "/USR/SHARE/TSUNG/TSUNG-1.0.DTD" >
<tsung loglevel= "notice" dumptraffic= "false" version= "1.0" >
<clients>
<client host= "localhost" use_controller_vm= "true" >
</client>
</clients>
<servers>
<server host= ' 127.0.0.1 ' port= ' 5222 ' type= ' tcp '/>
</servers>
<!--register 200000 users in less than minutes--
<load>
<arrivalphase phase= "1" duration= "unit=" Minute ">
<users maxnumber= "200000" interarrival= "0.0025" unit= "second" ></users>
</arrivalphase>
</load>
<options>
<option type= "Ts_jabber" name= "Global_number" value= "5" ></option>
<option type= "Ts_jabber" name= "Userid_max" value= "200000" ></option>
<option type= "Ts_jabber" name= "domain" value= "erlang-projects.org" ></option>
<option type= "Ts_jabber" name= "username" value= "Tsung" ></option>
<option type= "Ts_jabber" name= "passwd" value= "Tsung" ></option>
</options>
<sessions>
<session probability= "Name=" "Jabber-example" type= "Ts_jabber" >
<request>
<jabber type= "Connect" ack= "local" ></jabber>
</request>
<request>
<match do= "Abort" when= "Match" >error</match>
<jabber type= "register" ack= "local" id= "new" ></jabber>
</request>
<request>
<jabber type= "Close" ack= "local" ></jabber>
</request>
</session>
</sessions>
</tsung>
Modify the address of the server to be tested
<servers>
<server host= ' 127.0.0.1 ' port= ' 5222 ' type= ' tcp '/>
</servers>
Add the maxusers configuration, if the user does not have this parameter created
<clients>
<client host= "localhost" use_controller_vm= "true" maxusers = "30000" >
</client>
</clients>
The meaning of this configuration is to create a 20000 user for the server, where the user name is tsungxxx, the password is tsungxxx, where XXX is 1 to userid_max Each step value is 1.
<options>
<option type= "Ts_jabber" name= "Global_number" value= "5" ></option>
<option type= "Ts_jabber" name= "Userid_max" value= "200000" ></option>
<option type= "Ts_jabber" name= "domain" value= "erlang-projects.org" ></option>
<option type= "Ts_jabber" name= "username" value= "Tsung" ></option>
<option type= "Ts_jabber" name= "passwd" value= "Tsung" ></option>
</options>
Run
Tsung-fjabber_register.xml start
After running, Tsung will save the data in the ~/.tsung/log/ directory
PS: If there is a problem with the configuration file or if the middle of the operation is forced to close, sometimes the process is not closed, the next run will be an error, use the following command to see if there is a process not killed.
Tsung Preliminary Introduction Installation