HTTP Load Testing With Siege- A Beginners Guide

Alpy
3 min readOct 22, 2020

--

Siege is a benchmarking and http load testing tool. Siege was written on GNU/Linux and it is not supported by Windows. Let’s install it on Mac OS & see how to test.

  1. Install brew on your Mac
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

2. Once brew is installed , use the ‘brew install siege’ command to install siege

3. You can verify installation using siege -v command

If you see the version , Congratulations , Siege is ready to use !!

4. Let’s test API using the siege tool. I am using a public API for basic test purpose.

Siege -c5 -t10s http://dummy.restapiexample.com/api/v1/employee

5. Below are various options to run with Siege command

6. Here is the performance metrics returned after Load Test

  • Transactions is the number of server hits.
  • Availability is the percentage of request exceuted successfully.
  • Elapsed time is the total time taken by entire siege test.
  • Data transferred is the amount of data transferred to simulated user. It contains the header information as well as content.
  • Response time is the average time it took to respond to each user’s requests.
  • Transaction rate is the average number of transactions handled by server server per second.
  • Throughput is the average number of bytes transferred from the server to all the simulated users per second
  • Concurrency is average number of simultaneous connections.
  • Successful transactions is the number of times the server returned a success code (200).

Using the Siege command options above, you can increase concurrent users & test with different loads.

7. Let’s try API Post Request with JSON body. I am again using the public API with 5 concurrent users for 10 seconds and posting the JSON data. Below is the Command for this scenario -

siege -c5 -t10s -b — content-type=”application/json” ‘http://dummy.restapiexample.com/api/v1/create POST {“name”:”test”,”salary”:”123",”age”:”23"}’

You can modify the request as per your requirement and run different test.

Reference1- https://www.joedog.org

--

--

Alpy
0 Followers

A Developer, A Technology Enthusiast & A Believer