Tsung million pressure test II: environment construction, configuration file preparation and operation, report generation

Keywords: perl

Tsung installation

Tsung running environment installation

Check the installation of dependent packages to avoid errors during installation. (when the software packages of the operating system are fully installed, these packages are usually installed, and all can also be skipped. This step can be solved one by one in case of problems later.)

rpm -qa build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel

There are in each package system disk or image.

Install erlang, gnuplot, perl5

  • erlang: because Tsung is developed based on erlang, you have to install this environment first. Install the software
  • perl5: script support environment for generating reports
  • gnuplot: report statistics image generation tool
  • Libtemplate Perl: drawing template library required to generate reports

The following describes two online installation methods and one offline manual installation tool method, which is determined according to the source of the installation package.

erlang installation

Method 1: search and upgrade the software list from the software warehouse on the Internet

admin@iZa:~$ sudo apt-get update
admin@iZa:~$ sudo apt-get install erlang

Mode 2:

admin@iZa:~$ sudo yum install erlang

Refer to the article when the yum command is not available

Set the environment variables to use when installing Tsung in the next step

admin@iZa:~$ export PATH=$PATH:/usr/local/erlang/bin/

Verify that erlang was successfully installed

admin@iZa:~$ erl

The installation is successful as follows:
​​

gnuplot, perl5, libtemplate Perl installation

Mode 1:

admin@iZa:~$ sudo apt-get install perl5

admin@iZa:~$ sudo apt-get install gnuplot

admin@iZa:~$ sudo apt-get install libtemplate-perl

Mode 2:

admin@iZa:~$ sudo yum install perl5 gnuplot libtemplate-perl

Verify that the installation was successful

1. Command to view and display the current version of perl.

admin@iZa:~$ perl –v


2. Command to view the installed version of gnuplot

admin@iZa:~$ gnuplot

Tsung installation

1. Download the installation package from the official website http://tsung.erlang-projects.org (the latest version is 1.7.0)

admin@iZa:~$ sudo wget http://tsung.erlang-projects.org/dist/tsung-1.7.0.tar.gz

2. Unzip the installation package

admin@iZa:~$ sudo chmod 777 tsung-1.7.0.tar.gz

Some operating systems do not need horizontal bars. You can try both commands

admin@iZa:~$ sudo tar zvxf tsung-1.7.0.tar.gz (or sudo tar -zvxf tsung-1.7.0.tar.gz)

3. Compile and install

admin@iZa:~$ cd tsung-1.7.0/
admin@iZa:~$ sudo chmod 777 tsung-1.7.0/
admin@iZa:~/tsung-1.7.0$ sudo ./configure --prefix=/usr/local/tsung
admin@iZa:~/tsung-1.7.0$ sudo make
admin@iZa:~/tsung-1.7.0$ sudo make install

4. To verify whether the installation is successful, make a soft connection first to facilitate the use of the tsung command

admin@iZa:~$ sudo ln -s /usr/local/tsung/bin/tsung /usr/bin/  
admin@iZa:~$ tsung

5. After tsung installation, two command files will be generated:

tsung
tsung-recorder

The default generation is in the / usr/local directory. You can use the - h parameter to view all their parameters:

Tsung running

Configure scenario script

Tsung performs pressure measurement according to the parameter content in the XML configuration file. The default Tsung loads the configuration file: ~ /. tsung/tsung.xml

No ~ /. tsung folder, need to create

sudo mkdir ~/.tsung

There is a sample XML file under / usr/share/doc/tsung/examples. The configuration of HTTP is http_simple.xml

cd /usr/local/tsung/share/doc/tsung/examples/
sudo cp http_simple.xml ~/.tsung/tsung.xml

After successful replication, the contents are as follows, only a small part of which is shown

Execute script

sudo tsung -f ~/.tsung/tsung.xml start

Generate report

After the test, switch to the latest log path.

sudo cd ~/.tsung/log/20190312-0153/

First make a soft connection to facilitate the use of tsung_stats.pl command

sudo ln -s /usr/local/tsung/lib/tsung/bin/tsung_stats.pl /usr/bin/

Use tsung_stats.pl generates reports. The default is under the current path.

sudo tsung_stats.pl

Posted by NArc0t1c on Sat, 18 Sep 2021 14:46:20 -0700