doing horrible things with dns - web directions south
DESCRIPTION
How can we make use of DNS to improve the performance of web sites? A simple introduction to DNS and a neat trick to improve web site performance using DNS.TRANSCRIPT
Doing Horrible Things
to DNS(in the name of science)
@sh1mmer Yahoo! Inc
The basics of DNS
San Francisco - Mission Branch
San Francisco - Main Library
New York City - 5th & 42nd Branch
New York City - 5th & 42nd Branch
San Francisco - Main Library
NYC
San Francisco - Main Library
San Francisco - Mission Branch
NYC
SF
San Francisco - Mission Branch
NYC
SF
Mission
NYC
SF
Mission
Me
GTFO!It's 3am!
DNS for performance
Page Load Time vs. Bandwidth
Page Load Time vs. Round Trip Time
Trend Curves for Bandwidth vs. RTT
Serial HTTP loading - 1 domain
Parallel HTTP loading - 3 domains
So why not just use a loads of domains?
DNS Lookup
Ideal? 1 DNS query many parallel threads
Option 1: SPDY (by Google)
Good: Multi-thread TCP connections Bad: Only works on Chrome :(
Option 2: Do horrible things to DNS
Mucking about with C names
CNAMES are hosts which are aliases of other hosts
enki:~ $ dig yahoo.com
; <<>> DiG 9.4.3-P3 <<>> yahoo.com;; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32801;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 7, ADDITIONAL: 7
;; QUESTION SECTION:;yahoo.com. IN A
;; ANSWER SECTION:yahoo.com. 5935 IN A 69.147.125.65yahoo.com. 5935 IN A 72.30.2.43yahoo.com. 5935 IN A 98.137.149.56yahoo.com. 5935 IN A 209.191.122.70yahoo.com. 5935 IN A 67.195.160.76
...
;; Query time: 45 msec;; SERVER: 202.171.190.10#53(202.171.190.10);; WHEN: Wed Oct 13 17:23:39 2010;; MSG SIZE rcvd: 345
Query
Response
ajax1.hackerhouse.org. 1800 IN CNAME ajax2.hackerhouse.ajax2.hackerhouse.org. 1800 IN CNAME ajax3.hackerhouse.ajax3.hackerhouse.org. 1800 IN CNAME ajax4.hackerhouse.ajax4.hackerhouse.org. 1800 IN CNAME ajax.hackerhouse.ajax.hackerhouse.org. 1800 IN A 192.168.1.1ajax.hackerhouse.org. 1800 IN A 192.168.1.2ajax.hackerhouse.org. 1800 IN A 192.168.1.3ajax.hackerhouse.org. 1800 IN A 192.168.1.4ajax.hackerhouse.org. 1800 IN A 192.168.1.5
We now have 5 hostnames with 1 DNS query
5 hostnames x 6 request per host =
30 parallel requests
Doing Horrible Things
to DNS(in the name of science)
@sh1mmer Yahoo! Inc
Questions?