A bit of down time at work let my mind wonder a bit. I was designing a single location application on Digital Ocean (load balancer to app servers to DB with DNS). All fine. Then I thought what if the application will have a lot of traffic in America and Japan so I want to have data centers located in strategic geographic locations New York, California and Tokyo to speed up requests. All with the above setup syncing needed data. I get the wan connections.
What I do not get is how would typing in www.awesomesite.com get to one of those data centers without having to put something like a region in the url? I assume Facebook, Google and Amazon do something for this I am just having no luck figuring this out.
EDIT
There appear to be two ways of handling this.
Letting DNS do what it does with "load balancing" aka Round-Robin DNS. Which has some pretty well documented faults but is a good cheap solution.
The other is actual load balancing using something like NGIX or HAProxy. But documentation is sparse out there.
- This can be for disaster recovery?
- High Availability?
What I am trying to understand more accurately is option 2. More specifically
- Where would such proxies be located?
- Is there a single proxy or multiple?
- How is it still efficient if there is one global load balancer?
- How does DNS know which one to access if there are multiples (is it more round robin)?
This is my current thoughts. There A and B are the proxies for internet traffic and then a DMZ with a proxy for the clusters. This isn't anything real just from my head from some reading so please don't be too harsh...