Use Tsung to load test web application 

Joined:
04/09/2007
Posts:
784

September 23, 2013 09:00:22    Last update: September 23, 2013 09:17:55
Tsung is an open-source multi-protocol distributed load testing tool. It's written in Erlang, but don't let that dissuade you. Here are some simple steps to get started.
  1. Install Tsung. On Ubuntu, this is simply: sudo apt-get install tsung.
  2. Create a config file (tsung.xml):
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd" [] >
    <tsung loglevel="info" dumptraffic="true">
        <clients>
    	<client host="localhost" use_controller_vm="true"/>
        </clients>
    
        <servers>
    	<server host="192.168.80.160" port="80" type="tcp"></server>
        </servers>
    
        <load>
        <arrivalphase phase="1" duration="10" unit="second">
    	<users interarrival="2" unit="second"></users>
        </arrivalphase>
    
        <!--
        <arrivalphase phase="2" duration="10" unit="minute">
    	<users interarrival="1" unit="second"></users>
        </arrivalphase>
        -->
        </load>
    
        <sessions>
    	<session name="home-page" type="ts_http" probability="100">
    	<request> 
    	    <http url="/" method="GET" version="1.1"/>
            </request>
    	</session>
        </sessions>
    </tsung>
    

    Beware of the dumptraffic attribute. You might want to set it to false for a real load test.
  3. Run the test:
    $ tsung -f tsung.xml start
    Starting Tsung
    "Log directory is: /home/drxi/.tsung/log/20130923-1031"
    

  4. Generate the reports:
    $ cd /home/drxi/.tsung/log/20130923-1031
    $ /usr/lib/tsung/bin/tsung_stats.pl 
    creating subdirectory data 
    creating subdirectory gnuplot_scripts 
    creating subdirectory images 
    warn, last interval (1) not equal to the first, use the first one (10)
    No data for Match
    No data for Event
    No data for Async
    No data for Errors
    

  5. Open the report file in your browser: file:///home/drxi/.tsung/log/20130923-1031/report.html.


For HTTPS testing change the server line to:
<servers>
	<server host="192.168.80.160" port="443" type="ssl"></server>
</servers>
Share |
| Comment  | Tags