Skip to content

Instantly share code, notes, and snippets.

@g105b
Last active March 11, 2024 06:17
Show Gist options
  • Save g105b/34ec96a305b74087d5a64db27d1b9fec to your computer and use it in GitHub Desktop.
Save g105b/34ec96a305b74087d5a64db27d1b9fec to your computer and use it in GitHub Desktop.
Pool 100 parallel curl requests at a time
#!/bin/bash
target=${1:-http://example.com}
while true # loop forever, until ctrl+c pressed.
do
for i in $(seq 100) # perfrom the inner command 100 times.
do
curl $target > /dev/null & # send out a curl request, the & indicates not to wait for the response.
done
wait # after 100 requests are sent out, wait for their processes to finish before the next iteration.
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment