Load Testing using Apache Bench - Post JSON API

Load test using Apache Bench


We have been using Apache Bench to load test our rest microservices. One of the most useful situaiton while performing a load testing, is to change the number of concurrent requests parameter.

Apache Bench is a simple tool which has helped us to do this quick testing to see whether our services break on huge load.

How to Install Apache Bench on Ubuntu - 18.04 LTS

In order to install Apache Bench all you have to do is:

$ sudo apt install apache2-utils


How to execute "ab" for POST API

  • First create the JSON body to be posted, add that json data to a file with follwoing syntax:
$ cat my_data.json

 json='{"queryType" : "groupBy","dataSource" : "pixel-feed","dimensions" : [],
"granularity" : "all","filter" : {"type" : "selector","dimension" : 
"pixel_id","value" : "122112"},"intervals" :  ["2018-12-01/2018-12-07"],
"aggregations" : [{"type": "count", "name": "pixel_count"}]}'

     Note: json='<your_json_body>'
  • Run the ab load test using the following code:
$ ab -n 2000 -c 40 -T application/json \
   -p my_data.json  http://18.120.22.120:8083/druid/v2/?pretty

    Note: the above api hit's 2000 (n) number of requests with 40 (c) concurrent requests. Remember to add T and p parameters which are very useful for adding content type and data respectively.

More

Type the following to get more detail on ab tool

$ ab -h

Comments

  1. It was an excellent & super Blog to see from you which is very useful. Thank you so much for gathering all this information about Reactjs vs Angular. it’s very clever and will be extremely helpful for all people.

    ReplyDelete
  2. Being a well-recognized React JS Development Company offers reliable website design and website development services for a growing range of businesses across diverse verticals. Their team of expert React JS developers proved a track record by providing custom app development services, high-quality and efficient deliverables based on the client requirement within budget. Hire Top React Native Developers for your ReactJS development project!

    Read More: Best React JS Development Companies in India

    ReplyDelete
  3. Here are the Top Mobile App Development Companies New York which produce excellent app development services along with additional services and resources that support any business demands.

    ReplyDelete

Post a Comment

Popular posts from this blog

SSH using Chrome Secure Shell app with SSH identity (private key and public key)

NGinx + Gunicorn + Flask-SocketIO based deployment.