testingbenchmarkingapachebench

How to send json from apache benchmark without external file?


I have JSON from postman collection and i am iterating the requests list and calling ab from my script. get is working fine. I have json of request body, how i can send json with ab without using external file.


Solution

  • Yes, ab can read from stdin and we can use that to send JSON without using an external file.

    echo '{"foo": "bar"}' | ab -p /dev/stdin -k -c 1 -n 10000 "http://localhost:8080" > ret.txt