Created
July 20, 2016 21:17
-
-
Save sandeepraju/1f5fbdbdd89551ba7925abe2645f92b5 to your computer and use it in GitHub Desktop.
curl command to check the time to first byte
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 | |
# file: ttfb.sh | |
# curl command to check the time to first byte | |
# ** usage ** | |
# 1. ./ttfb.sh "https://google.com" | |
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com" | |
curl -o /dev/null \ | |
-H 'Cache-Control: no-cache' \ | |
-s \ | |
-w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" \ | |
$1 |
Thanks
If somebody needs it:
seq 50 | xargs -Iz ./ttfb.sh "url" | awk '{sum+=$NF; count++} END {print "Sum of Total time:", sum; print "Average Total time:", sum/count}'
outputs the average total time like this:
Sum of Total time: 8.07832
Average Total time: 0.161566
@dunklesToast with my fork you can run ttfb -n 50 example.com/example/url
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!