Skip to content

Instantly share code, notes, and snippets.

@Sarfarazsajjad
Created June 10, 2020 12:44
Show Gist options
  • Save Sarfarazsajjad/38977419c235759f39042e3396e39254 to your computer and use it in GitHub Desktop.
Save Sarfarazsajjad/38977419c235759f39042e3396e39254 to your computer and use it in GitHub Desktop.
using apache ab for stress testing websites

Installation:

sudo apt-get install apache2-utils

GET example

ab -n 10 -c 2 http://dummy.restapiexample.com/api/v1/employees

POST example

ab -p ./post.txt -T application/json -H 'Some-Header: value_of_header' -n 10 -c 2 http://dummy.restapiexample.com/api/v1/create

Content of post.txt:

{"name":"test","salary":"123","age":"23","id":"719"}

Parameters dictionary:

 -p : POST a file (post.txt has the JSON data to be POST'ed)
 -H : Add a header
 -T : Set a content type
 -c : no. of concurrent clients
 -n : total no. of requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment