Tuesday, May 21, 2013

Download from OTN slow? Check DNS

Sometimes download from Oracle Technology Network (OTN) is really slow, but it may not be Oracle's fault. Oracle is using Akamai Technologies  to distribute the software. You can see this if you do an nslookup on download.oracle.com and see it resolves (finally) to a host under akamai.net.

They have servers all over the world and when things work as they are supposed to the box on your end should connect to a host physically near you and not on another continent. If your download is really slow find the IP address that your DNS resolves for download.oracle.com (or the host you are downloading from) and then use a geo-lookup site to see where it is located.

Just now the DNS server for my local ISP (get.no) resolved download.oracle.com to two servers in California:

[root@rio ~]# nslookup download.oracle.com
Server:         84.208.20.110
Address:        84.208.20.110#53

Non-authoritative answer:
download.oracle.com     canonical name = download.oracle.com.edgesuite.net.
download.oracle.com.edgesuite.net       canonical name = a1961.d.akamai.net.
Name:   a1961.d.akamai.net
Address: 64.209.77.10
Name:   a1961.d.akamai.net
Address: 64.209.77.18

I used www.infosniper.net to find where this host was located. Me being in Oslo this was obviously not optimal. The only DNS server I can remember is 8.8.8.8 which is one of Google's public DNS servers. I decided to change /etc/resolv.conf to use 8.8.8.8 as the primary DNS server, and download.oracle.com now resolves to two servers in Germany:
[root@rio ~]# nslookup download.oracle.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
download.oracle.com     canonical name = download.oracle.com.edgesuite.net.
download.oracle.com.edgesuite.net       canonical name = a1961.d.akamai.net.
a1961.d.akamai.net      canonical name = a1961.d.akamai.net.0.1.cn.akamaitech.net.
Name:   a1961.d.akamai.net.0.1.cn.akamaitech.net
Address: 46.33.72.121
Name:   a1961.d.akamai.net.0.1.cn.akamaitech.net
Address: 46.33.72.129

Here is the link if you like maps... I then flushed DNS in Firefox, restarted the download, and confirmed with netstat -an that the connection now went to a server in Germany. The download went much faster, well, at least for a while... YMMV.

Actually I thought that using Google's DNS server could give a suboptimal response if Google's DNS server was located somewhere far away (like in USA), but clearly they have some magic here that returns an IP address better than the DNS server of my local ISP.