Is there a way to send different body for a post request when using apache bench?
Here is my query
ab \
-n 5 \
-c 3 \
-T "application/json" \
-v 4 \
-p my_json_body.json \
http://localhost:8080/myendpoint
Here is my json
# my_json_body.json
{ "foo": "bar" }
What I want to do is to send a different json body for half of my concurrent requests (-c means concurrent)
So if I send four requests at a time, I want two of them to send
{ "foo": "bar" }
and I want two of them to send
{ "hi": "bye" }
Is this possible? The docs do not mention it as a possibility but it seems like it is a feature that might be in there somewhere. https://httpd.apache.org/docs/2.4/programs/ab.html
The answer I used and recommend is to write a bash script to run ab twice concurrently and pass different json to the two instances of ab. See Execute multiple shell scripts concurrently for bash concurrency advice
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With