Running Tsung against opentaps server

From Opentaps Wiki
Revision as of 23:03, 7 March 2008 by Gkfabs (talk | contribs)
Jump to navigationJump to search

This is a page to assist with running tsung against opentaps server.

Installing tsung

Tsung needs the erlang platform to be installed. We will not extend over it, because rpm or deb versions just runs fine. http://www.erlang.org/

Tsung is a tool only available for linux platform under binary form. Maybe it could be runned against windows with the erlang windows version and the cygwin platform.

We used Tsung with erlang 5.6.1 The version 1.2.2 has some problem linked to xml parsing, so we prefer the version 1.2.0

You may want to modify tsung-1.2.0/src/tsung_controller/ts_os_mon.erl, depending on which platform you are running the opentaps server. The scripts which do the os monitoring (cpu, memory and network graphs) may not be convenient for your platform.

Compilation

  • For debian users, just type fakeroot debian/rules binary.
  • For the others a ./configure, make, make install will do it.

To run the client with the configuration file tsung.xml, just have

$ tsung -f tsung.xml start

Configuration file

The configuration file and all the file needed to do a tsung stress testing are available in the directory hot-deploy/opentaps-tests/scripts/tsung/

  • readcsv.erl a small erlang script used to generate the login string from the user and password read
  • tsung.xml the configuration file for tsung
  • userlist.csv the list of the users which will be used successively to login

readcsv.erl

In this file, there is only one function called user. The step done are:

  • ts_file_server:get_next_line() to read one line in the file
  • string:tokens(Line,";") to separate the user and the password
  • "USERNAME=" ++ Username ++"&PASSWORD=" ++ Passwd to return the login string

You have to compile this file

$ erlc readcsv.erl 

You will get a file called readcsv.beam, which you have to copy in the tsung binary directory. In our case it is

/usr/lib/erlang/lib/tsung-1.2.0/ebin/

tsung.xml

The tsung.xml file is the configuration file which has the different scenarios to execute. There is some comments in there.

Here is an overview:

Configuration of the client

By default only one http client is configured which is localhost. You can configure as many http clients as you want. The computer which fires the tests must have a ssh access with passphrase.

  <clients>
    <client host="localhost" use_controller_vm="true"/>
  </clients>

Configuration of the server

By default the opentaps http server is configured on localhost:8443. You can change it too.

  <servers>
    <server host="localhost" port="8443" type="ssl"/>
  </servers>

Configuration of the monitoring (cpu, memory, network)

The monitoring has to be configured to access the opentaps server. In our case it is localhost. The computer which fires the tests must have a ssh access with passphrase.

  <monitoring>
    <monitor host="localhost" type="erlang"/>
  </monitoring>

Arrival of the clients on the tested server

It is configured in the load node and by a phase system. For each phase you put the duration of the phase and the frequency of arrival of the clients. You can have as many phase as you want. In this case, there is one phase of one minute which is configured, where clients arrived each 25 seconds. We will have 4 clients.

  <load>
   <arrivalphase phase="1" duration="1" unit="minute">
     <users interarrival="25" unit="second"/>
   </arrivalphase>
  </load>

The different options

  • user_agent UserAgent string to use
  • thinktime The thinktime of a user between his last response received and the next request he will send.
  • file_server the file with the login
  <options>
    <!-- which type of client are we going to fire -->
   <option type="ts_http" name="user_agent">
    <user_agent probability="80">Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21</user_agent>
    <user_agent probability="20">Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4</user_agent>
   </option>
    <!-- Each client has a random thinktime (time between two request) around 3 -->
   <option name="thinktime" value="3" random="true" override="true"/>
    <!-- TOBEMODIFIED Absolute path for the file from which we generate the login and password -->
   <option name="file_server" value="userlist.csv"/>
  </options>

userlist.csv

It is a basic csv file which associate on one line a user and a password separated by a ; ie

DemoSalesManager;crmsfa

This users will be used successively to login into the opentaps server.

Logs, Reports and Graphics generated

Logs

In the directory ~/.tsung/log/ you will get the logs file.

  • tsung_controller@FabsLaptop.log is the log where you can have the errors related to tsung
  • tsung.dump is the dump of all the requests and responses generated
  • tsung.log is used to generate the reports and graphics
  • tsung.xml is the configuration file

To generate the reports and graphics, just execute /usr/lib/tsung/bin/tsung_stats.pl in the directory of logs.

Reports

  • Main statistics

MainStatistic.png

Graphics