As Dream.In.Code has grown, delivering our content faster, and more reliably to countries all over the world has become very important. I'd like to tell you how I've leveraged several new(er) technologies to make DIC as fast and reliable as it is today.
1. Faster DNS Lookups w/ IPAnyCast
If you own a domain, you probably have NS1.YOURWEBHOST.COM and NS2.YOURWEBHOST.COM. Typically, these server(s) are in the same datacenter, or might even be on the same server. Ideally, you want geographically separated servers and no fewer than 2 completely different servers. But why you ask? If my server is down along with my DNS servers, nobody can get to my site anyway. That's true, but wouldn't you like to be able to move your web site to a new host quickly and not have to wait the 2-3 days for your domain to re-propagate?
Enter services like UltraDNS, EasyDNS, DNSMadeEasy, and many others. They provide redundant, geographically separated DNS servers. This keeps your eggs out of one basket (i.e. your web host), and gives you the control to move your site to a new host quickly.
That's great and all, but we can take geographically separated one step further and say "geographically closest". Using IP AnyCast technology, visitors to your site will be routed to the closest geographical DNS server. Dream.In.Code uses DNSMadeEasy which has over 20 servers located around the world. Visitors are routed to the closest (and often quickest) DNS server. This makes the time from "click" to the time the page starts downloading just that much quicker.
Here's an example of IP AnyCast in the US:
2. Content Delivery Network
Content Delivery Networks (CDNs) are nothing new. Big sites have been using the services of Akamai and others for years. But with the popularity of online video and larger file sizes, CDNs are becoming more and more popular (and accessible) for the little guys.
CDNs address 2 major problems. The first being limitations in the browser. Computers are faster, servers are faster, and connections are faster. So why can't we download more than 3 things at once with Internet Explorer? Because IE has a built-in limit to only open 3 simultaneous connections to any 1 host at a time. This is why a couple months ago I moved all the static content on DIC to static.dreamincode.net. This tricks IE in to downloading more things at once. But, this also puts tremendous strain on my web servers. In fact, the server went from handling around 30 HTTP requests/second, to over 60 HTTP requests/second. Moving all the static content to a CDN fixes this.
The second problem CDNs address is distribution. Delivering static content, video, or large files is very resource intensive. A CDN caches that content on multiple Points of Presence (POP) around the world and delivers it using one of many POPs. This allows for almost unlimited scalability. Again, it is possible to take this a step further using IPAnyCast to deliver the content from the closest geographical POP.
Dream.In.Code has been using CDNLayer from SoftLayer (which is ultimately provided by Internap). CDNLayer let's us do what's called "Origin Pull" which essentially pulls the files requested from our web server and caches them on the POPs (as opposed to us uploading every image, CSS, page, etc.). If you look at the source code, you'll notice references to http://http.cdnlayer.com/dreamincode/ this address translates directly to http://www.dreamincode.net/ so any file requested from the CDN is cached and delivered.
Let's take a look at why IPAnyCast (for DNS or a CDN) makes things so much quicker. Below are 2 traceroutes from Europe. One is coming back to Dallas (where the DIC Datacenter is) and the other is going to the CDN (and hitting the London POP):
You'll notice from Europe, it takes 19 hops to get back to our Dallas server. With the CDN, it only takes 10. And the maximum response time is only 32ms compared to 334ms back to Dallas.
So the combination of using IPAnyCasted DNS and an IPAnyCasted CDN speeds up content delivery dramatically, and takes a lot of strain off the web server. Price wise it's not bad either, I'm paying $59.95/yr for the DNS and $20/mo for the CDN (up to 200GB/mo)
You can read more about IPAnyCast here:
And more about the CDN we're using here:
Page 1 of 1
Replies To: How a CDN & IPAnyCast Makes DIC Faster
Page 1 of 1