29 January 2008

Load testing a Rails application with Tsung

First, RTFM :-) http://tsung.erlang-projects.org/user_manual.html

Installing erland and Tsung


Tsung is written in erlang and uses perl libraries to generate graphics.
sudo apt-get install -Y erlang
sudo apt-get install gnuplot-nox
sudo apt-get install libtemplate-perl libhtml-template-perl libhtml-template-expr-perl

wget http://www.process-one.net/downloads/tsung/1.2.1/tsung-1.2.1.tar.gz
tar xvf tsung-1.2.1.tar.gz && rm tsung-1.2.1.tar.gz
rm -R tsung-1.2.1.tar.gz && rm tsung-1.2.1.tar.gz
cd tsung-1.2.1
./configure
make
sudo make install

Set up Tsung


Check out the examples in /usr/share/doc/tsung/examples

Here is my
~/.tsung/tsung.xml to let your start






























Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21
Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4





















Run tsung with:
tsung start

Starting the Tsung recorder

Configure your browser
If you use your machine as tsung client and also for the webserver, don't forget to remove "localhost" from the "No proxy For" textfield otherwise all requests to your web application will bypass the proxy server used by the tsung recorder!




Commands:
tsung recorder
tsung stop_recorder

Then you just have to copy the xml file generated the recoreder in ~/.tsung/

Generating the html report

(make sure you have perl installed with the Template Toolkit is used for HTML reports (see http://template-toolkit.org/ . For ubuntu gutsy, there is package available

cd to the log directory of your test (say ~/.tsung/log/20040325-16:33/) and use the script tsung_stats.pl:


/usr/lib/tsung/bin/tsung_stats.pl



(use –help to view all available options)

No comments: