Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I have 3 servers for my website, how would I direct users geographicaly to the right place?

The main server is in Australia, but content is synced to a US server. As someone in the uk my ping times to the US server are under 100ms, but Australia is 300-600ms.

What are my options for directing traffic to the correct server?

  1. Wide IP?
  2. Detect and lookup IP on the first server they hit and then redirect to another domain?

How do Googe do it?

share|improve this question

migrated from stackoverflow.com Dec 23 '09 at 15:56

This question came from our site for professional and enthusiast programmers.

    
Try ServerFault.com for more/better answers to your question. We focus on programming here. –  DOK Dec 23 '09 at 15:38

5 Answers 5

The best way IMHO is to recompile BIND with GeoDNS patch

then you can control clients by views i.e.

view "north_america" {

  match-clients { country_US; country_CA; country_MX; };

   zone "example555.com" {type master;file "pri/example555-north-america";};
share|improve this answer
    
Asume I am an idiot! Which I am... –  MrHinsh Jan 5 '10 at 23:23

Google does it using a technology called "anycast". They use the same IP assigned to multiple machines that are placed around the world. Long story short, the least expensive according to the BGP system, and often shortest path is used.

Normally multiple paths to one IP are exported when multihoming... more than one ISP comes into your network, so there is more than one way to get there. You take the cheapest / fastest path in. With anycast, everything happens the same way, but the different paths lead to physically different machines in far away places instead of just more than one way to the same machine. To the end user, it doesn't matter because the content they get from any of them will be the same.

Because this trick takes having a BGP id and at least a /24 block worth of addresses that you won't be able to use for anything else, you probably won't use their solution. You can contract this out for static content via Akamai Technologies, and probably several other companies as well. I don't know if any providers will handle dynamic content in that way.

You can use a service such as MaxMind's GeoIP as well. That may be the most cost-effective, but you'll have to do some upfront coding to redirect your users based on checks against the IP data. Note that they do offer a free database, and for the country-level direction, that's probably good enough. Disserman's BIND patch idea may also work out just fine, using DNS replies to direct people instead of redirects. This could get confusing for some very technical users, or when debugging strange issues where different hosts think the same name points different places.

share|improve this answer

The latter approach will work and is in fact used by lots of servers but you could also consider global load-balancing as this will fix this problem and also help with business continuity.

share|improve this answer

I'd advertise the second option, coupled with a GeoIP lookup to redirect to the closest server.

share|improve this answer
    
Do if the mail server is in Australia a UK user would need to load a page on the Aus server with a 300-600ms latency? –  MrHinsh Jan 12 '10 at 19:00

If the website is identically served by the three servers, make it transparent and do not redirect. It does not make sense to have identical content on different domains.

Also, the techniques used to do that will let you fail-over if one of the servers fails.

share|improve this answer
    
So how would you achieve it? –  MrHinsh Jan 5 '10 at 23:23

Your Answer

 
discard

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.