Mysql – How to redirect users to different servers based on their location

asp.netcdnhostingMySQLwindows-server-2008

I have a website which is developed by using ASP.NET and MY DB is MySQL. Currently it hosted in USA Servers. But When I try to access it near India dynamic contents are loading too slowly. It is acceptable since request has to go to another side of the world. In USA its really fast. I already connected this site with cloudflare CDN. But CDN is useful for static contents. My every pages almost have dynamic contents.

So I want to scale this website. So if a request came from America I want to handle that request from USA server and If a request came from ASIA I want that to handle from an ASIAN Server. But keep in mind no matter where they were redirected content should be same on two servers. ( Two servers should be sync )

So how to achieve this architecture?

How google, Facebook,Yahoo do this? How they serve world wide? I think they have datacenters on every continent. How they sync with each other?

Best Answer

In addition to what answered by @Gabriel-Talavera, I'd add a couple of notes:

  • Network routing, as well as Geographical Load Balancing, is totally unrelated to "data synchronization" between different servers. They are two problems addressed with plenty of very different technologies.

As the title of your question seems to be focused on the networking side, I'll focus on the first part (the network routing issues).

As you can see by yourself, requirements are hard to be met by small ICT companies. But "global" companies (like the ones you mentioned in your OP), will have no problem adopting it.

As a side note, the first time I heard about "anycast" was thanks to a CloudFlare BLOG post, where they discussed (...among lots of other things), how anycast can be also adopted as a counter-measure to D-DOS attacks.

Related Topic