Run

This keeps hitting your server at the rate of 20 calls/second until you ask it to stop. The goo.gl just redirects to the raw script from Github (shown below).

Code Explanation

There’s a while true loop that has a sleep 1 in it so the block get executed every second.

echo $(($(date +%s) — START)) | awk ‘{print int($1/60)”:”int($1%60)}’

This is for printing the current minute and second of the execution (12:45).



Then there’s a for loop that runs the number of times given as the first argument. Inside that, a function is called with the url and & so that it’s run in the background.

get $2 &

Inside the get function, we have a verbose silent curl to make the request. Then piped to tr removes all the newline. Then the following awk command appends a ----- 05:23:19 PM to it and logs it in /temp/perf-test.log

awk -v date=”$(date +’%r’)” ‘{print $0"

-----”, date}’ >> /tmp/perf-test.log

If you want to add custom headers, add it in the curl command in the file.

PS. Not having `inline code` options in medium is a bit painful