Using Tsung For Load and Stress Testing

In web development load testing entails putting demand on a web service or website and assessing its response. Load testing is usually used to observe how the website will perform under peak load. Modern web developers have numerous options for performing load testing on their websites. There are cloud based options such as loader.io, Cloudtest, NeoLoad, WebLOAD and Silk Performer. There are other options which can be run on a local network such as Apache JMeter, BlazeMeter, Tsung and Gatling. In this article we will look at Tsung in detail and the various pros and cons that one may encounter.

Tsung is an open source load and stress testing tool. It is written in Erlang, which is a language suited for concurrency, allowing it to better utilize CPUs that have multiple cores. Tsung supports various protocols such HTTP, HTTPs, LDAP, SOAP and XMPP. Tsung can also be used to stress test PostgreSQL and MySQL databases. Tsung can also monitor operating system performance metrics such as memory, network traffic and CPU utilization using Erlang agents, Munin or SNMP. Tsung provides HTML reports that displays performance of the system during the load test.

Tsung is only available on Linux. On Ubuntu installing Tsung is as simple running sudo apt-get install tsung. On other Linux distributions you can install Tsung from source or using the deb files from Github. Load tests are created using XML files and running tsung with the file as a parameter. The XML file allows you to specify the number of requests to be made, the number of CPUs to use and the IP and port of the server. If you don’t want to worry about configuring an XML file, you can use a service like LoadViewTesting.

You can also specify the arrival rate of the requests to the server being tested. Requests arrive randomly modelling real life operation of the server. Requests to the server can also be made depending on your website. You can create JSON requests and XML requests. Tsung can also create dynamic requests that change based on a percolator engine (this doesn’t need to be configured with LoadView). Another interesting feature in Tsung is the distributed feature. Install Tsung on all multiple clients and you get a report of the server’s performance to under distributed load.