Built with 
HomeBrave Tech WorldAbout SiteMarcelo Calbucci

Brave Tech World

Week 12
SMTWTFS
24252627282930

Entries for March 28, 2007


March 28, 2007


WED
28
MAR
2007

Our new DNS Service

By Marcelo

 

    Without DNS you would have to remember IP addresses for emails and websites, which would be clearly bad for somebody like me.

 

    Right now all Sampa sites run from a single server. Yeah, you heard it right. A single low end server hosts all our sites, and serves thousands of users every day.

 

    But we bought a new server and is ready to roll. Except by one thing. All Sampa sites DNS entries point to the same IP address. That is done with an catch-all entry in DNS, like in "*.sampasite.com -> 207.115.80.185".

 

    To enable the second server, our DNS will have to query our database to where each site is located, on server 1 or server 2. The existing solutions for DNS are very unfriendly when you have thousands (or millions) of DNS records. You would probably need multiple dedicated DNS servers for that, which is what large ISPs and Host providers do.

 

    So, I decided to write my own DNS Server. How hard can it be? Turns out, that the RFC 1035 is pretty clear and easy to understand. There is way more to DNS than most people think of. It wasn't that hard and it took just about 3 days.

 

    I just finished implementing the DNS Server code, and I'm almost done with testing it. The beauty is that the entire DNSServer code has only two functions exposed. One to start the service and one callback to get the Resource Records (RRs) response (ok, three functions: one to stop the service). Now it is just a matter of hooking up to our database (and add some caching) to make it work.

 

    That will be fun.

  



Similar Content
Powered by Google