Sakib Sami' Blog

Newbie programmer, Java fan, Rosogolla lover, Mom's little kid.

HTTP Load testing with Tsung

After developing a web application we have to test performance. And regarding the result we need to improve the api.

Now lets see how we can test a restful api using Tsung.
Tsung is a erlang based application to test http, xmpp, mqtt or any other tcp, udp based protocol.

=> Installation instruction

Now create a configuration file to send load,

<?xml version="1.0" encoding="utf-8"?>  
<!DOCTYPE tsung SYSTEM "/usr/local/Cellar/tsung/1.7.0/share/tsung/tsung-1.0.dtd">  
<tsung loglevel="warning">

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

    <server host="" port="9000" type="tcp"/>

    <arrivalphase phase="1" duration="1" unit="minute">
      <users arrivalrate="100" unit="second"/>

    <session name="dummy" weight="1" type="ts_http">
        <http url="/api/v1/product/list?page=0&amp;limit=4" method="GET" version="1.1" >

[+] change /usr/local/Cellar/tsung/1.7.0/share/tsung/tsung-1.0.dtd according to your system.

[+] change host and port as per your requirement. In request

[+] change url to your api path.

[+] One thing to remember change & with &amp; otherwise it won't work and throw exception.

[+] For POST request put body in contents tag or contents_from_file="location_of_file". replace " with &quot;.

[+] add header by <http_header name="Referer" value=""/> within http.

[+] set content type of body by content_type='application/json'

[+] Move to log directory and execute /usr/local/Cellar/tsung/1.7.0/lib/tsung/bin/ to generate static graph.

=> Documentation

Go with OOP

Go / Golang is a modern programming language developed by Google. Though Go is not a Object Oriented…

go, oop

Hands on MVP in Android application development

What is MVP ? -> MVP stands for Model-View-Presenter. MVP is a software development methodology of k…

android, mvp, design-principle, moxy