Main Features
- High performance:the load can being distributed on a cluster of client machines
- Multi-protocols using a plugin system: HTTP, WebDAV, SOAP, PostgreSQL, MySQL, LDAP, Xmpp/jabber, BOSH, MQTT and AMQP is currently supported. SSL is also supported.
- Several IP addresses can be used on a single machine using the underlying OS IP aliasing
- OS monitoring (CPU, memory and network traffic) using SNMP, Munin or Erlang agents on remote servers.
- XML configuration system; Several sessions can is used to simulate different type of users. Dynamic sessions can easily described in XML (this can is used to retrieve at runtime a ID from the server output and Use it later in the session).
- In order to generate a realistic traffic, user think-times and the arrival rate can be randomize using a probability distr Ibution
- HTML reports can generated during the load to view response times measurement, server CPU, etc.
Tsung is developed in Erlang, running the Tsung requires support for the relevant Erlang dependency package.
Brief introduction
Tsung is a stress testing tool that can test servers including HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and Xmpp/jabber. For HTTP testing, Tsung supports
HTTP 1.0/1.1, which contains a proxy-mode session record, supports GET, POST and PUT, and DELETE methods, supports cookies and basic WWW authentication, and also supports SSL.
How the Tsung Works
(1) Each virtual user of Tsung is a lightweight process of Erlang. There is a big difference between this and LoadRunner.
(2) The virtual user disappears after completing the session.
(3) A large number of virtual users (Erlang lightweight processes) are built on ERLANGVM.
(4) A test machine can start more than one ERLANGVM, currently according to 1 CPU boot 1 ERLANGVM.
First, pre-installation inspection environment
1. Check the Environment:
[Email protected] bin]# lsb_release-alsb Version: : Base-4.0-amd64:base-4.0-noarch: CORE-4.0-AMD64:CORE-4.0-NOARCH:GRAPHICS-4.0-AMD64:GRAPHICS-4.0-NOARCH:PRINTING-4.0-AMD64: Printing-4.0-noarchdistributor ID: centosdescription: CentOS release 6.4 (Final) Release: 6.4Codename: Final
2. Ensure that the following tools are installed:
Yum install gcc-y Yum install perl-y yum install UnixODBC yum install unixodbc-devel
Second, installation
1. Download and install Erlang
[Email protected] ~]#cd/usr/local[[email protected] local]#mdir-p erlangwget/http Www.erlang.org/download/otp_src_R14B04.tar.gz
Note: If the "configure:error:No Curses library functions found" error appears, try to install:
[Email protected] otp_src_r14b04]#yum install-y ncurses-devel
2. Download and install Tsung
[Email protected] ~]#cd/usr/local[[email protected] local]#mkdir-p Tsung
TAR-ZXVF tsung-1.4.2.tar.gz ./configure--prefix=/usr/local/tsung--with-erlang=/usr/local/ Erlangmakeinstall
3. Download and install the Perl template to generate the report template
[Email protected] ~]#cd/usr/localwget http://cpan.org/modules/by-module/Template/ template-toolkit-2.24.tar.gzcd template-toolkit-2.24 make Test
Note: If the following prompt appears:
[Email protected] template-toolkit-2.24]# perl makefile.plcan ' t locate extutils/makemaker.pm in @INC (@INC contains:./L ib/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/perl5/vendor_perl/usr/share/perl5/vendor_perl/usr/ Lib64/perl5/usr/share/perl5.) At makefile.pl Line 11.BEGIN failed--compilation aborted for makefile.pl line 11.
Workaround:
Yum Install Perl-extutils-cbuilder Perl-extutils-makemaker
4. Download and install gnuplot for chat generation
[Email protected] local]#yum install-y gnuplot gd libpng zlib
Third, check whether the installation is successful
[[email protected] local]# perl-v command to view current Perl version information. [[Email protected]]# gnuplot command to view the installed version of Gnuplot [email protected] local]# Erl
Iv. setting environment variables after installation
Add Erlang, Tsung environment variables after installation
vim/etc/profile Export path= $PATH: $JAVA _home/bin:/usr/local/erlang/bin:/usr/local/tsung/bin:/usr/local/nginx/sbin: $PATH ( Modify your own actual variable) : Wq save, exit source/etc/profile no error is successful tsung-v Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [Kernel-poll:false]eshell V5.8.5 (abort with ^g) 1&G T
V. Use and generate reports
1. Create a new. Tsung directory under the root folder for log and XML configuration, and the test configuration file can be referenced in the/usr/local/tsung/share/doc/tsung/examples/directory
[Email protected] local]#mkdir ~/.tsung[[email protected] local]#cp/usr/local/tsung/share/doc/ Tsung/examples/http_simple.xml ~/.tsung/tsung.xml
2, run, default execution script ~/.tsung/tsung.xml configuration
Tsung Start Starting Tsung "Log directory is:/root/.tsung/log/20150311-0536"
3. Enter the log directory to see the generated report information
cd/root/.tsung/log/20150311-0536 ls-a... Match.log [email protected] Tsung.log tsung.xml
4. Enter the log directory where the graphical report needs to be generated, such as/root/.tsung/log/20150311-0536
/usr/local/tsung/lib/tsung/bin/tsung_stats.pl lsdata gnuplot.log gnuplot_scripts graph.html images match.log report.html [email protected] Tsung.log tsung.xml
5, drag the report.html to the Windows system, directly open to view.
Currently the latest version of the Tsung tool is 1.6.0, it is important to note that MQTT is supported for Tsung1.5.1 versions and above, and that only Tsung1.6.0 starts to support MQTT username and password certifications.
Tsung Test Tool Basic Test command for Tsung-f ~/.tsung/mqtt.xml-l < log save path > Start
Mqtt.xml are as follows (can be found under the/usr/share/doc/tsung/examples path):
<?xml version= "1.0"?>
<! DOCTYPE Tsung SYSTEM "/USR/SHARE/TSUNG/TSUNG-1.0.DTD" >
<tsung loglevel= "Debug" version= "1.0" >
<!--below for the client configuration, can have a number of clients, where Ubuntu to ensure that through SSH Ubuntu can remotely log on to Ubuntu this machine, here is recommended by the key pair to the remote client login. The following is similar to the LoadRunner load generator, which simulates the user. For detailed configuration Please refer to official documentation http://tsung.erlang-projects.org/user_manual/conf-client-server.html-->
Ext: Tsung: Open source Multi-protocol distributed load & stress testing Tools