Skip to content

Instantly share code, notes, and snippets.

@Wurushu
Last active March 27, 2025 10:56
Show Gist options
  • Save Wurushu/bc31d5d72f92f41141c7e29d91a7b97f to your computer and use it in GitHub Desktop.
Save Wurushu/bc31d5d72f92f41141c7e29d91a7b97f to your computer and use it in GitHub Desktop.
Test HTTP API with simultaneous request with CURL shell script or Apache Bench
#!/bin/bash
URL="http://localhost:8081"
FILE="test.mp3"
REQUEST_COUNT=$1
for i in $(seq 1 $REQUEST_COUNT); do
curl -X POST -F "file=@$FILE" "$URL" > "curl_response/output_$i.log" 2> "curl_response/error_$i.log" &
done
wait
echo "All requests are done! ✅"
########################
# Apache Bench version #
########################
# ab -n 100 -c 100 -v 4 -l -p test.json -T application/json http://localhost:8081 > ab_response/ab_output.log 2> ab_response/ab_error.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment