Brief introduction
Tsung is a stress testing tool that can test including HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and XMPP / Jabber server and so on. For test HTTP, Tsung support
HTTP 1.0 / 1.1, the session record contains a proxy mode support GET, POST, and PUT and DELETE methods, Cookie and supports basic authentication WWW, also supports SSL.
Works tsung's
(1) lightweight process Tsung each virtual user is a erlang of. Loadrunner this point and there is a big difference.
(2) the virtual disappearance of the user after the completion of session.
(3) a large number of virtual users (erlang lightweight processes) based on erlangVM.
(4) a plurality of test machine can start erlangVM, according to the currently active one erlangVM a cpu.
First, pre-installation check environment
1, viewing environment:
[root@localhost bin]# lsb_release -a LSB 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-noarch Distributor ID: CentOS Description: CentOS release 6.4 (Final) Release: 6.4 Codename: 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, the installation
1, download and install erlang
[root@localhost ~]#cd /usr/local [root@localhost local]#mdir -p erlang [root@localhost local]# wget http://www.erlang.org/download/otp_src_R14B04.tar.gz [root@localhost local]# tar -zxvf otp_src_R14B04.tar.gz [root@localhost local]# cd otp_src_R14B04 [root@localhost otp_src_R14B04]# ./configure --prefix=/usr/local/erlang [root@localhost otp_src_R14B04]# make [root@localhost otp_src_R14B04]# make install
Note: If ": error: configure No curses library functions found" error, try to install:
[root@localhost otp_src_R14B04]#yum install -y ncurses-devel
2. Download and install Tsung
[root@localhost ~]#cd /usr/local [root@localhost local]#mkdir -p tsung
[root@localhost local]# wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz [root@localhost local]# tar -zxvf tsung-1.4.2.tar.gz [root@localhost local]# cd tsung-1.4.2 [root@localhost tsung-1.4.2]# ./configure --prefix=/usr/local/tsung --with-erlang=/usr/local/erlang [root@localhost tsung-1.4.2]# make [root@localhost tsung-1.4.2]# make install
3, download and install the perl Template, templates for generating reports
[root@localhost ~]#cd /usr/local [root@localhost local]# wget http://cpan.org/modules/by-module/Template/Template-Toolkit-2.24.tar.gz [root@localhost local]# tar -zxvf Template-Toolkit-2.24.tar.gz [root@localhost local]# cd Template-Toolkit-2.24 [root@localhost Template-Toolkit-2.24]# perl Makefile.PL [root@localhost Template-Toolkit-2.24]# make [root@localhost Template-Toolkit-2.24]# make test [root@localhost Template-Toolkit-2.24]# make install
Note: If the following prompt:
[root@localhost Template-Toolkit-2.24]# perl Makefile.PL Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: ./lib /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 at Makefile.PL line 11.
Solution:
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
4, download and install gnuplot, for generating a chat
[root@localhost local]#yum install -y gnuplot gd libpng zlib
Third, check whether the installation was successful
[root @ localhost local] # perl -v perl command to view the current version information is displayed. [root @ localhostlocal] # gnuplot gnuplot command to check the installed version of [root @ localhost local] # erl command to check the installed version of erlang Erlang R14B04 (erts-5.8.5) [ source] [64-bit] [rq: 1] [ Threads-the async: 0] [the HIPE] [poll-Kernel: to false] eshell V5.8.5 (ABORT with G ^) [the root @ localhost local] # tsung tsung -v command to view the installed version
Tsung version 1.4.2
Fourth, set the environment variable after installation
Add erlang, tsung environment variables installed as
[root @ localhost local] # vim / etc / Profile Export the PATH = $ the PATH: $ JAVA_HOME / bin: / usr / local / Erlang / bin: / usr / local / Tsung / bin: / usr / local / nginx / sbin: $ PATH (modifying their actual variable) : WQ save, exit [root @ localhost local] # Source / etc / Profile is not being given the success [root @ localhost local] # Tsung -v Tsung Version 1.4.2 [root @ localhost local] # ERL -v the Erlang R14B04 (ERTS-5.8.5) [Source] [ 'bit-64] [RQ:. 1] [the async-Threads: 0] [the HIPE] [poll-Kernel: to false] eshell V5.8.5 (ABORT with G ^) . 1>
Fifth, use and generate reports
1, the root file folder .tsung new directory for storing log and the xml configuration, the test profile can refer to the / usr / local / tsung / share / doc / tsung / examples / directory configuration
[root@localhost local]#mkdir ~/.tsung [root@localhost local]#cp /usr/local/tsung/share/doc/tsung/examples/http_simple.xml ~/.tsung/tsung.xml
2, run, the default execution script ~ / .tsung / tsung.xml Configuration
[root@localhost local]# tsung start Starting Tsung "Log directory is: /root/.tsung/log/20150311-0536"
3. Log into the directory you can see the report generated information
[root@localhost 20150311-0536]# cd /root/.tsung/log/20150311-0536 [root@localhost 20150311-0536]# ls -a . .. match.log [email protected] tsung.log tsung.xml
4, need to Log into the directory to generate graphical reports, such as /root/.tsung/log/20150311-0536
[root@localhost 20150311-0536]# /usr/local/tsung/lib/tsung/bin/tsung_stats.pl creating subdirectory data creating subdirectory gnuplot_scripts creating subdirectory images No data for Session No data for Perfs No data for Transactions No data for Match No data for Event No data for Async No data for Size size_rcv is equal to 0 ! size_sent is equal to 0 ! [root@localhost 20150311-0536]# ls data gnuplot.log gnuplot_scripts graph.html images match.log report.html [email protected] tsung.log tsung.xml
5, report.html drag windows system, directly open to view.