Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We would like to mirror our site in the UK and the US for two reasons. So that...

  1. The site is fast for users located in either America/Europe.
  2. So that if either server goes down, the user can still access the website.

As for data sharing between the servers, we're going to use MySQL mirroring, and probably rsync to keep the files mirrored.

If we only needed to do point 1, then we could program some code to redirect users to either site based on their IP, but to do this, we'd have a single point of failure.

Is there a reasonably inexpensive way of telling users a different IP based on their location? Maybe we can do something fancy with our DNS server?

share|improve this question
Maybe I need to look at geodns? – nbolton Jun 27 '10 at 10:24
Even if you tell UK users to use the UK IP and US users to use the US IP you now have two sites with their own single points of failure. – Kyle Smith Jun 27 '10 at 13:49

"High Availability" is always fun :-)

On the "simple" side, you can specify multiple A records. This works in a (typically) round-robin style, and offers no ability to specify which server you want to serve by default. This means that you'll wind up with people in Britain getting served by the American servers, and vice versa. This is not what you want (least of all because we Americans get confused by all of the extra 'u's that show up in words like colour) ;-)

A more sophisticated solution would be using a DNS service that uses a feature similar to the one that you suggested in the comments. A technique exists called Global Service Load Balancing as well, which accomplishes something similar.

On the more expensive and sophisticated side, you could use BGP MultiSite MultiHoming, where you buy an Autonomous System Number (ASN), and advertise BGP routes to the same network from both sites. This theoretically ensures that everyone gets the "closest" (based on network accessibility) site.

Or, of couse, you can hire Akamai to distribute your data and applications for you. For a lot of money.

If you've got the money and expertise, I'd recommend the BGP multihomed solution. If not, you might want to look at the DNS solutions.

share|improve this answer

As Matt says, there are companies which will provide CDNs.

A cheaper approach would be to use RRDNS, with   A (UK address)   A (US address) A (UK address) A (UK address) A (UK address)
... A (US address) A (US address) A (US address) A (US address)
... A (UK address)

And on both servers, try to drop a cookie (if there's not one) indicating which continent the client is on (saves repeated expensive lookups).

Maintain the state of the 'other' system(s) in each server. When you get a connection on the address, redirect to the most local system for the customer which is available (e.g.

On the localised vhosts (uk. and us.) whenever a GET request comes in, if it is for a non-local vhost, check if the prefered host at that location is available, and redirect the customer there.

You'd probably want to implement better failover detection (avoiding split-brain) and detect looping between servers not to mention other tweaks.

Its not perfect and relies a lot on you coding your own redirect / failover handling.

A more practical solution might be to implement your own location-sensitive DNS server alternatively, there are a small, but growing number of DNS providers who can provide just such a service (again use RRDNS with lots of repeated local A and few remote A records).


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.