Skip to content

Instantly share code, notes, and snippets.

@nmfzone
Created March 25, 2020 23:04
Show Gist options
  • Select an option

  • Save nmfzone/588b7c313350c0d08e31aa158d8668e4 to your computer and use it in GitHub Desktop.

Select an option

Save nmfzone/588b7c313350c0d08e31aa158d8668e4 to your computer and use it in GitHub Desktop.
Experiencing slow curl Connection on DigitalOcean Droplets (Ubuntu 16.04)
########## DO NOT INCLUDE THIS ##########
# File Location: /etc/resolvconf/resolv.conf.d/head
#########################################
nameserver 8.8.8.8
nameserver 8.8.4.4
@nmfzone

nmfzone commented Mar 25, 2020

Copy link
Copy Markdown
Author

If you're experiencing slow curl connection, or slow python requests connection.

For me, the real issue is because the dns_resolution is very slow.

If you make a debug on curl request, with command:

$ curl -w "dns_resolution: %{time_namelookup}, tcp_established: %{time_connect}, ssl_handshake_done: %{time_appconnect}, TTFB: %{time_starttransfer}\n" -o /dev/null -s "https://www.google.com"

For me, the dns_resolution showing 8.012.

Then, I've found the solution to this problem is to add those value in /etc/resolvconf/resolv.conf.d/head
After that, my dns_resolution showing 0.012. dang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment