time curl -X POST --location "http://127.0.0.1:8080/url" \
-H "Content-Type: application/json" \
-d "{\"id\":\"1234567893\"}" \
-s -o /dev/null -w "%{time_starttransfer}\n"
Output will be like:
127618
real 0m0.139s
user 0m0.001s
sys 0m0.011s
I.e. the real request response time (without DNS lookup) is 127618ns i.e. 0.127618s. The pure curl execution time was 139ms and 1ms curl worked itself and 11ms.
Now we can write a script that will call a hundred times and output request time:
#!/bin/sh
i=0
while [ $i -lt 100 ]; do
curl -X POST --location "http://127.0.0.1:8080/token1" \
-H "Content-Type: application/json" \
-d "{\"id\":\"1234567893\"}" \
-s -o /dev/null -w "%{time_starttransfer}\n";
i=$(expr $i + 1)
done