How to achieve geo-distributed site

Why do I need a Geo-distributed site?
If you are serving to a global audience (or even an audience across geographies), it is very desirable to have your site geo-distributed to enable you to serve your site to users from closer to their location. So, instead of a site being hosted in a set of servers in one location, you host a set of servers in a set of locations which are geographically distant and strategically chosen to be closer to the biggest user clusters’ locations. 

Typically, these are known as mirrors. Mirrors are used by all global sites, especially all sites enabling file transfers/downloads. In fact, these sites let you choose your mirror for download to rule out any error while automatically selecting a mirror for you when you first visit.

What does it mean for my user?
It is entirely invisible to a normal user and he doesn’t normally figures out which mirror is he/she being served the site from. He/she still gets pages served on the same domain name and the same URL’s. Technically, someone would basic computer science and networking know-how would know or be in a position to find out the difference in mirrors.

How would this work?
A typical process of first-time requesting a page from a website includes the following steps –

  1. User’s machine requests its ISP’s DNS servers for the location of the site
  2. User’s ISP’s DNS server sends out a request to site’s DNS server for the location of the site
  3. Site’s DNS server provides to the location of the site (in form of an IP Address)
  4. User’s machine requests the site location for the page

The trick here, in geo-distributing this site, lies in 2nd step. This is enabled by a Anycast DNS service. What that means is –  a set of identical DNS servers therefore, when a nslookup (the basic networking request to resolve a domain name) is done on a domain name, the user’s ISP’s DNS server would send back the location it receives from the site’s DNS server which responds before the others – typically the closest DNS server. 

dns-resolution-gslb



All the site’s DNS servers carry different locations of the site hence, based on which DNS server does a user get the domain name resolved from, the mirror he/she would end up being served from would vary. These DNS servers also cache this information with themselves for other users in their networks who might request for the same domain name some time later.

PS – I did get lose in how I was writing this post many a times therefore, if you find any flaws in the post, do post a comment and I would edit it accordingly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s