Can your DNS do this?

The internet is all about instant gratification. That goes for producers as well as consumers. Generally the biggest shock a novice web developer will experience is when they realize that their shiny new domain won’t be accessible for up to 2 days. 2 days? DAYS? That’s an eternity on the web. Not only do you have to wait, but you have to wait an unpredictable amount of time, and just because the domain name has propagated to you doesn’t mean the rest of the world will be able to see your site yet. DNS propagation is the bane of the internet.

You do have some choice, though. You can suffer DNS propagation once, when you first register your domain name. Or, you can suffer DNS propagation repeatedly, every time you switch hosting companies. Yeah, I’d take the first option too. If you have a domain name you care about, then you should absolutely positively not have the DNS managed by your hosting company. Never ever ever. But this is what the vast majority of us do. We register our domains and then stick in ns1.dreamhost.com (or whatever) when we are prompted to supply nameservers. We just don’t know any better. I didn’t know any better until I moved to a specialized Ruby on Rails hosting company which doesn’t supply email or DNS hosting (RailsMachine). At first, I was a little bit put out by this, mostly because I had always taken these things for granted as part of a “hosting package”. But, I signed up for DNS Made Easy as per RailsMachine’s suggestion and within a few minutes realized that using default DNS hosting is just about the silliest thing you can do on the web. (so thanks, Bradley)

Here are some things which you can do if you have an independent DNS provider:

  • Switch to a new hosting company at any time with propagation times measured in minutes, not days.
  • Automatically and instantly send traffic to a backup site if your primary site should go offline. (Or while you are doing maintenance - much nicer than just a capistrano maintenance.html page.)
  • Mix and match your hosting. Have blog.yourdomain.com point to a Dreamhost WordPress one-click install. Have status.yourdomain.com point to a Blogger.com blog for an independent status blog to communicate with your customers in the event of downtime. Host your email with absolutely anyone, independent of who does your domain hosting. Use mint.yourdomain.com for your mint statistics installation and send this traffic to Dreamhost without needing to install php on a Rails-friendly host (they don’t get along). Change any of these hosting arrangements at any time without affecting any of your other hosting arrangements.
  • Redirect http://www.yourdomain.com to yourdomain.com (or vice versa) for SEO at the DNS level instead of using mod_rewrite.
  • Use DNS for cheap load balancing over multiple IP addresses.

This really is a no brainer for me. If your hosting servers go offline due to a power failure, you lose not only your site but also your DNS. You can change your DNS servers with the registration company (unless this egg is in the same basket with the other 2), but you’re back to a 48 hour propagation for this to have any effect. On the other hand if you have independent DNS, you can simply point to a new IP address and your site can be back up in a matter of minutes depending on your Time To Live (TTL). If you have this set up in advance then there might not be any noticeable downtime.

Is there a downside? Well, you have to do a little more work. When you let your hosting company manage your DNS, they will automatically set up lots of little DNS records for you. It took me a few minutes to recreate all the Dreamhost email DNS records. And, Dreamhost could decide to change those in the future, or one of the IP addresses I’m pointing to could change. This isn’t too likely, though, and if it happens it’s just a case of updating the records. If you need to point to a dynamic IP address then DNS Made Easy will actually monitor this for you and update your record if the IP changes.
It took a little time, but I found the process of setting up these records to be very educational. And now that I have them set up I am very happy with the level of control I have. My setup has worked perfectly for me up to now. I actually use Dreamhost email for some domains and DNS Made Easy’s own email product for some others where email uptime is absolutely crucial. On another note DNS Made Easy’s SMTP server is a fantastic product if your application’s automatically generated email gets marked as spamalot (which is pretty common if you use shared hosting email).

What if the DNS server itself goes down? Well, this is always a risk. But, you have this same risk if you are letting your hosting company run your DNS. I’d bet my business on a company that specializes in DNS hosting and has much more to lose if there’s any downtime. I’ve never had a DNS outage since I moved to dnsmadeeasy, but have had several hosting outages in that time.

I’m talking about DNS Made Easy because they are the company I have experience with. The prices are very, very reasonable and I’ve always had great service from them. There are other DNS services out there, including some free ones, and I’d appreciate if you have experience with any of these to mention them in the comments.


Comments

Aidan Finn 12 Jan 2008

I’ve used http://www.dyndns.com and http://www.zoneedit.com in the past. Zonedit is free but it’s interface is a bit unintuitive.

Both worked fine for me. I’m currently using DNS made easy as it has has a better feature:price ratio that the other two.

topfunky 12 Jan 2008

Spot on.

I also use DNS Made Easy for my RailsMachine servers. I was surprised how easy it was to switch over a few sites in the past few weeks. I setup a TTL to 300 seconds a few days in advance, then transferred the relevant database and redeployed to the new server. Five minutes later I was up and running.

It’s also helpful to plan ahead and define separate subdomains for services, even if they start out on the same machine. I had some Git repositories on one machine and needed to switch them to another. If I had started out with something like git.yourdomain.com, it would have been easy to just copy the repositories to the new machine and switch the DNS with no change to other cloned repositories.

Paul Campbell 13 Jan 2008

This used to drive me crazy back in the day, but I solved it by a slightly more direct route—I set up my own DNS servers. I was originally on djbdns (installed via http://www.djbdnsrocks.org), which was great, until I found MyDNS (http://mydns.bboy.net/) … both are great, but being able to serve DNS out of MySQL made it super easy to automate and integrated with a virtual hosting web interface that I was building at the time.

I still wasn’t happy with the lag times when doing site migrations, so I built a solution on top of mod_proxy. Basically the steps were these:

1. Set up mod_proxy to point your new server to your old server.
2. Set up DNS to point to your new server
3. All requests now get proxied through the new server back to the old one
4. When you’re ready to launch on the new server, just configure the webserver to serve requests the new server rather than proxy. You can take your time because the changes don’t take effect until…
5. …you restart the web server!

The result: Instant, controllable gratification when changing from one server to another. Compounded, if something goes wrong in the new environment, you’re just one server restart away from proxying back to your old one.

Rob.O 13 Jan 2008

Great post Ana! I was personally very confused when I heard RailsMachine doesn’t provide DNS but now I see its a good thing.