Skip to main content

DNS - Domain Name Subsytem (A very High Level Dive)

Many of us would already know what a DNS is but for starters, it is the thing that converts the URL to IP address when we to hit a URL.
The part I want to focus is how underrated and much unknown is this system to people apart from the fact I mentioned above. 

In fact, I am lucky enough to get an in-depth look at how crucial DNS system and how it forms the backbone of highly scalable distributed system where you agree to an SLA for some milliseconds or might less at InMobi. So this post is more focused towards starters and not so fancy because that's how it should be understood.

Why is DNS important ?
Imagine you have to deploy a service on the internet and you agree to your consumers for 100 or 200 ms latency  but an improper DNS setup or DNS query can add 200ms or up of latency and added to that your geolocation.Hence it becomes important to tune your DNS server to your need.Let's get into details. This is a very high-level view of things and people should explore more.

DNS Server:
The basic work of DNS is to the mapping of URL to an IP address.But this is how it does.

Two types of DNS servers:
   Authoritative Name Server
   Recursive Name Server

 Let's take an example:   news.google.com
Here  com : Top Level Domain , google : second level domain , news : subdomain


DNS server reads a URL from right to left and does a recursive travel of name servers until it reaches Authoritative servers. 

Steps:

1. The moment we hit the URL , our browser searches in the cache for DNS resolution and if it doesn't get it ask for our ISP's name server. Here is where Recursive name servers come into the picture.
 By the way even after "com" there is a dot which we don't need to enter explicitly and that dot represents root server.
What it does is from the right of URL it starts parsing and queries to root(i.e dot .) server (one of many root servers)for the address of com server. And for all top level domains(lime com,io,..etc) these are fixed server addresses hard coded into DNS servers.

2. Then com server has info about the server which has a record about google.com  and make a referral to it.This is where when we purchase a domain we have to register our domain to a name server  and is called Authoritative Name Server.
So the flow is :

URL --->Recursive Name server--->Root Server-->Top Level Domain server--->Authritative Name Server



For more info refer :
https://www.appliedtrust.com/resources/infrastructure/understanding-dns-essential-knowledge-for-all-it-professionals







Comments

Popular posts from this blog

Introduction to GIT and GITHUB

In this series I would be covering the basic operation of  GIT so that even a new comer can easily feel comfortable with the terminologies and usage of git system. The first post is just a brief introduction that will help you clarify the questions raising about this new thing. What is a Git? Git is simply a software that helps you manage your source code.That means each change that you make to a source code is recorded in its history.So it can also be called as Source Code managemnt system. To use git for a particular project all you need is to initialize the current project folder so that it will be tacked by the git system.I will show it in further documents about how to do it. Every Git working directory(or you can say your project folder) is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server. What is GitHub ? In layman terms you can think of

PyCache - A simple, yet extensible in memory Python caching library/framework

https://github.com/Abhisar/PyCache A Small library/extensible framework that aims to solve the problem of needing a cache while coding small/medium scale python projects without depending on 3rd party cache systems. PyCache This library aims to solve the problem of generic object(Python) caching without depending on 3rd party caching systems like Memcached or Redis for cases where it isn't really required. Library has been written in such a way it can be extensible by following standards through implementations of Python Abstract Base Classes. pycache folder  : It has all the base classes. One that ensures ensures all cache schemes follow a similar implemntation i.e https://github.com/Abhisar/PyCache/blob/master/pycache/BaseCache.py  and Other one is for the Objects to be cacheable they have to subclass this Base class  https://github.com/Abhisar/PyCache/blob/master/pycache/BaseCacheable.py CacheImplenations folder : This folder contains different caching schemes. Cur

Difference between spin locks and semaphores--Some Notes

up vote down vote accepted Both manage a limited resource. I'll first describe difference between binary semaphore (mutex) and spin lock. Spin locks  perform a busy wait - i.e. it keeps running loop(In turn heavy CPU usage example is in Reactor usage of AsyncTaskExecutors): while (try_acquire_resource ()); ... release(); It performs very lightweight locking/unlocking but if the locking thread will be preempted by other which will try to access the same resouce the second one will simply try to acquitre resource untill it run out of it CPU quanta. On the other hand  mutex  behave more like: if (!try_lock()) { add_to_waiting_queue (); wait(); } ... process *p = get_next_process_from_waiting_queue (); p->wakeUp (); Hence if the thread will try to acquire blocked resource it will be suspended till it will be avaible for it. Locking/unlocking is much more heavy but the waiting is 'free' and 'fair'. Semaphore  is a lock that is allowed to