OpenSRP Load Testing
OpenSRP load testing uses the tool Tsung.
Tsung is a heavy duty, load-testing tool that is used to benchmark the performance of servers and applications.
The main main advantage of Tsung is
- High performance — Tsung can simulate up to 50,000 simultaneous users per physical computer.
- Ease of use — Based on XML configuration, Tsung removes the need for developers to write complex scripts. The tool handles tasks such as managing cookies automatically, so developers can focus on designing the scenarios not managing lines of code.
More feature of Tsung are on http://tsung.readthedocs.io/en/latest/features.html
Installing Tsung on Ubuntu
Install Erlang and depencies sudo apt-get install erlang gnuplot libtemplate-perl
Install Tsung
- Download the latest version from http://tsung.erlang-projects.org/dist/. OpenSRP uses the current version 1.7.0. Run
wget http://tsung.erlang-projects.org/dist/tsung-1.7.0.tar.gz
tar zxvf tsung-1.7.0.tar.gz
cd tsung-1.7.0
./configure
make
make install
Verify installation
Check the version of tsung installed on your system.
tsung -v
Installing on Mac
On MacOS install Tsung using Homebrew. brew install tsung
To be able to extract reports also install cpan templates by using sudo cpan Template
Running the load tests
Tsung needs you configure an xml that has defines the configuration. The XML file has the test cases, load definition, application, server or database being tested.
Refer to the documentation on http://tsung.erlang-projects.org/user_manual/configuration.html for understanding on how to configure the Tsung configuration.
Use the command below to execute the load tests
tsung -f opensrp.xml start
You can get the opensrp configuration file from https://github.com/OpenSRP/opensrp-scripts/blob/master/load-testing/opensrp.xml
The repositories has other configuration file
- https://github.com/OpenSRP/path-zambia-etl/blob/load-testing/load-testing/opensrp_ec.xml that only tests EC model sync and submission of data
- https://github.com/OpenSRP/path-zambia-etl/blob/load-testing/load-testing/opensrp_without_openmrs.xml tests requests that don't directly interact with OpenMRS
- https://github.com/OpenSRP/path-zambia-etl/blob/load-testing/load-testing/upload_image.xml for testing uploading images
Use the Tsung reporting tool to extract statistics and metrics from the the load tests
Go to log directory. This usually output from the terminal when running the load test
cd ~/.tsung/log/20180503-1847/
Generate graphical Report:
/usr/lib/tsung/bin/tsung_stats.pl
Open report in Firefox browser:
firefox report.html
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.