Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rebyn/a936eb27b4e7b06c7d7c to your computer and use it in GitHub Desktop.
Save rebyn/a936eb27b4e7b06c7d7c to your computer and use it in GitHub Desktop.
Use Curl to identify bottlenecks in your service layers.
\n
Size: %{size_download}\n
DNS: %{time_namelookup}\n
Connect: %{time_connect}\n
SSL: %{time_appconnect}\n
Transfer: %{time_starttransfer}\n
Total: %{time_total}\n
# SSL request to hostname that is not in DNS
> curl -o /dev/null -w @curlformat https://beta.finance.yahoo.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 255k 0 255k 0 0 233k 0 --:--:-- 0:00:01 --:--:-- 233k
Size: 261255
DNS: 0.522
Connect: 0.536
SSL: 0.667
Transfer: 0.772
Total: 1.094
# Repeat another 2 requests to the same host: DNS is now cached, saving 0.5 seconds.
# The final request re-uses the already open connection that Curl is holding, making
# DNS lookup, Connection time, and SSL handshake time all 0.
> curl -o /dev/null -w @../curlformat https://beta.finance.yahoo.com -o /dev/null https://beta.finance.yahoo.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 255k 0 255k 0 0 108k 0 --:--:-- 0:00:02 --:--:-- 109k
Size: 261238
DNS: 0.005
Connect: 0.086
SSL: 0.230
Transfer: 1.930
Total: 2.341
100 255k 0 255k 0 0 495k 0 --:--:-- --:--:-- --:--:-- 1048k
Size: 261255
DNS: 0.000
Connect: 0.000 <-- connection pool - 80ms connect time already completed above
SSL: 0.000 <-- connection pool - 140ms SSL handshake already completed above
Transfer: 0.064
Total: 0.515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment