Last active
March 22, 2024 12:16
-
-
Save sdesalas/0fb0d24a91f5d92f71a992452de1162b to your computer and use it in GitHub Desktop.
Poor mans apache bench
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# CurlBench. Dont want to install apache bench? | |
# | |
# Runs "curl" concurrently using arguments. | |
# | |
# Example: Make 100 requests to some domain (concurrency = 10) | |
# $ curl.sh http://some.domain.com 100 10 | |
# | |
set -B | |
url=${1:-http://some.domain.com} | |
count=${2:-1} | |
concurrency=${3:-1} | |
iterations=$((count/concurrency)) | |
for i in $(seq 1 $iterations); do | |
echo ''; | |
echo "$i ------------------------"; | |
echo "GET $url" | |
echo ''; | |
seq 1 $concurrency | xargs -I $ -n1 -P$concurrency curl -D - "$url"; | |
echo ''; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment