Created
February 4, 2015 23:58
-
-
Save hatzopoulos/dff15196d5fe8c9bbf16 to your computer and use it in GitHub Desktop.
curl performance tricks
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
## All Stats | |
curl -o /dev/null -s -w "\n\ | |
url_effective: %{url_effective}\n\ | |
http_code: %{http_code}\n\ | |
http_connect: %{http_connect}\n\ | |
time_namelookup: %{time_namelookup}\n\ | |
time_connect: %{time_connect}\n\ | |
time_appconnect: %{time_appconnect}\n\ | |
time_pretransfer: %{time_pretransfer}\n\ | |
time_redirect: %{time_redirect}\n\ | |
time_starttransfer: %{time_starttransfer}\n\ | |
size_download: %{size_download}\n\ | |
size_upload: %{size_upload}\n\ | |
size_header: %{size_header}\n\ | |
size_request: %{size_request}\n\ | |
speed_download: %{speed_download}\n\ | |
speed_upload: %{speed_upload}\n\ | |
content_type: %{content_type}\n\ | |
num_connects: %{num_connects}\n\ | |
num_redirects: %{num_redirects}\n\ | |
redirect_url: %{redirect_url}\n\ | |
ftp_entry_path: %{ftp_entry_path}\n\ | |
ssl_verify_result: %{ssl_verify_result}\n\ | |
TTFB: %{time_starttransfer}\n\ | |
Total Time: %{time_total}\n" \ | |
http://www.example.com | |
# example from http://www.pinoytux.com/linux/capture-time-to-first-byte-using-curl | |
curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" http://linux.com | |
# example from http://archive09.linux.com/articles/57715 | |
echo "`curl -s -o /dev/null -w '%{time_starttransfer}-%{time_pretransfer}' http://linux.com/`"|bc | |
# a nice example from https://josephscott.org/archives/2011/10/timing-details-with-curl/ | |
# Step one: create a new file, curl-format.txt, and paste in | |
# n | |
# time_namelookup: %{time_namelookup}n | |
# time_connect: %{time_connect}n | |
# time_appconnect: %{time_appconnect}n | |
# time_pretransfer: %{time_pretransfer}n | |
# time_redirect: %{time_redirect}n | |
# time_starttransfer: %{time_starttransfer}n | |
# ----------n | |
# time_total: %{time_total}n | |
# n | |
# Step two, make a request: | |
curl -w "@curl-format.txt" -o /dev/null -s http://wordpress.com/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment