Benchmarking API's with ApacheBench

?
S
Bash

Simple benchmarking tool (ab). apt-get update apt-get install apache2-utils useradd -m -d /home/test -s /bin/bash -g sudo test passwd test su test

1ab -n 1000 -c 4 localhost:3000
2# Requests per second:    87.12 [#/sec] (mean)
3
4ab -n 100 https://www.coderecipes.org/api/recipes/\?from\=1\&to\=10
5# Requests per second:    4.03 [#/sec] (mean) *1 request (at same time)
6
7ab -n 100 -c 8 https://www.coderecipes.org/api/recipes/\?from\=1\&to\=10
8# Requests per second:    32.09 [#/sec] (mean) *8 concurrent requests (at same time)
9
10# Extra: Multiple commands execution with Paralell
11brew install parallel
12echo "https://www.coderecipes.org/api/recipes/\?from\=1\&to\=10\nhttps://www.coderecipes.org/api/recipes/\?from\=1\&to\=10" | parallel -j 2 "ab -n 100 {.}"
13
14
15# Pass Headers
16ab -n200 -c100 -H "clientId:test-client"-H "token:93e6acff-2ef9-4c85-9d0b-c9948a8ee93b" -v 2 http://127.0.0.1/oauth2/user/client/
17

Created on 2/22/2018