26

If I have a single domain with visitors from both USA and Europe and also have 2 servers, one in USA and one in UK, how can I force users from USA to go the USA server and visitors from UK to go to the UK server in order to reduce the ping of visitors?

First of all is this possible? And why companies like google have a different domain for each country?

ETL
  • 6,443
  • 1
  • 26
  • 47
Luka
  • 381
  • 3
  • 10
  • +1 For "Good contact delivery Question" – AminM Feb 16 '14 at 15:15
  • 14
    Might be worth just mentioning - if there's different content on the two servers, make sure there's a way for users to override the default and reach the other server, if necessary. At one point, for some bizarre reason, the IP address block my company was using was classified as being in Spain rather than the UK. The companies whose webpages insisted in switching me to the Spanish site rather than the English one with no escape value are the companies I no longer do business with. – Damien_The_Unbeliever Feb 17 '14 at 08:44
  • 15
    I've moved from the US to the EU and this stuff drives me *crazy*. If you have mirrors of the same content, sure, send me to the nearest. But most of the time, it isn't the same content and I'm going to the one I'm going to for a specific reason. I know what country I am in, and which I'll be in next week - but your site doesn't. In either case, I can make your site think I'm anywhere I want. Instead of 'force' think 'suggest' - IMHO. – Rob P. Feb 17 '14 at 09:20
  • 7
    And then there's multinationals. I've worked for the Dutch office of a UK subsidiary of the European division headquartered in Germany of a US company where our external IP addresses were from a French block. Hated having half the internet assume I was in France and insisting on providing localised content. – jwenting Feb 17 '14 at 10:42

9 Answers9

22

And why companies like google have a different domain for each country?

Because it makes it easier to have SEPARATE CONTENT for every country. Content should be static - so if you want English and for example Spanish pages to be indexed, they must have separate url's. One way is example.com/en - the other is en.example.com. The later scales better.

First of all is this possible?

Not for you. You need a provider that supports anycast routing.

To do it yourself you need your own internationally routed IP addresses - which are impossible to get for a normal user as the smallest block assigned is more than 4000 addresses (which you must USE) and the costs are high.

If you would get one you would get routing as an AS (Autonomous System) and just publish routes going to the closest server.

So, not for you. But some hosts may support it.

CDN's do it - so you can definitely move your static stuff off to a content delivery network.

What you can do is country prefixes, and then redirect to them from the main domain.

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
TomTom
  • 50,857
  • 7
  • 52
  • 134
  • Thanks. So, In order to do what I am looking for I need a domain, a server in each country and a CDN, right? – Luka Feb 16 '14 at 09:50
  • 1
    Not really, you can handle all of euopre from one server ;)"each country" may be a little hard. Each region (US, EU). THe CDN is optional - I would skip it. But separate domains and servers are the cheapest solution. – TomTom Feb 16 '14 at 09:58
  • Does CDN really worth it? I mean, ping from USA to Japan is about 500ms. Isn't this too much? – Luka Feb 16 '14 at 10:03
  • Well, a CDN also takes load off your server. THe idea is to move all static files (images, jscript, css) to a separate domain on the CDN. Less load. Not sure about the US - japan ping... i am in europe ;) – TomTom Feb 16 '14 at 10:18
  • can you more explain about anycast routing?? i want to do this In my country..Each province is connected to the server that is located in the same province. – AminM Feb 16 '14 at 15:17
  • DO you know wikipedia and google? Open your own quesiton, show what reserach you did and what you are missing. As per FAQ you should ask your own question AND show a minimal understanding of the technology. We are not here to teach basics. – TomTom Feb 16 '14 at 15:20
  • 1
    TomTom's answer sta\rts off well - but finishes rather abruptly without considering the issues and constraints. Unless you explicitly need to publish different content in different locations, the most manageable and low cost solution is to serve up non-cacheable HTML/AJAX from a single location and everything else via a *good* CDN - but READ THIS FIRST: http://www.cdnplanet.com/blog/which-cdns-support-edns-client-subnet/ (note that this applies to Anycast DNS hosting too) – symcbean Feb 16 '14 at 21:18
  • @TomTom i Read [Anycast](http://en.wikipedia.org/wiki/Anycast) but i want to do it in action in windows server.wikipedia don't give me step by step solution. – AminM Feb 17 '14 at 11:56
  • 2
    Step by step? Step 1: Hire a pro that did that. Step 2: follow his instructions. – TomTom Feb 17 '14 at 11:58
13

+1 for anycast routing as "the real solution".

An easier alternative is to provide different DNS records per continent. Amazon sells this as Latency Based Routing but I assume other large DNS providers offer similar tools.

mschuett
  • 3,066
  • 20
  • 21
11

Some people have mentioned CDNs as a solution. You don't really need that. All you need is for the authoritative DNS server for your domain to pick the optimal server for a given user based on where their DNS request is coming from (and potentially what the current load is). Akamai, for example, while also the largest CDN, offers a product called Global Traffic Management that is completely separate from its CDN offerings that provides this very service (for a fee). It accomplishes this by becoming the authoritative DNS server for the various domains you administer, and then for incoming DNS requests, it then hands out the IP addresses of your web servers, correctly accounting for load and locality.

If your servers can't handle your load (and you don't want to buy and administer more), that's when you want a CDN, but it doesn't sound like that's your problem.

8

You can use anycast routing. Google, for example, has DNS servers like 8.8.8.8, which are different servers depending on where you are.

You can also use a content delivery network for your static data.

And different domains for each country provides you with other advantages, but that is not going to help you if all your visitors use one domain, of course.

Halfgaar
  • 7,921
  • 5
  • 42
  • 81
  • 1
    And as "you" can not use anycast routing (way too high requirements for a normal user) - get a provider that support it. – TomTom Feb 16 '14 at 09:39
  • In the end, I don't understand why google uses different domains. They do this only for the ping between the countries? – Luka Feb 16 '14 at 09:41
  • @Luka - it has nothing to do with "ping". It has to do with managing their network/servers AND give the users a sense of familiarity. If you are going to a localized site with your country code, it makes you feel all warm and cozy. Marketing. – ETL Feb 16 '14 at 14:35
  • @ETL The most important part of this however is not relating to marketing, it is to ensure users are able to get content in a language they can read, a user who only speaks say German would not want to end up on an English landing page. – Vality Feb 17 '14 at 14:27
3

You could also look into Load Balancing based on Location proximity. Alternatively check out delivery accelerators like Fastly.

Peter
  • 131
  • 3
2

What you need is geographic load balancing. It's a very hard, non-trivial problem. The accepted answer is incorrect. You can do it. There was a page I saw a while back with a script that measures users ping and sends them to the nearest server. I THINK this was it: http://www.austintek.com/LVS/LVS-HOWTO/HOWTO/LVS-HOWTO.geographically_distributed.html

Also, F5 Networks sells a geographic load balancing router, but it's expensive.

Chloe
  • 1,094
  • 4
  • 16
  • 34
2

You can use DNS server which will bring visitors from each region to different computer.

Possible duplicate question as: Is there any DNS that supports Geo-location / Directional DNS?

Mladen Adamovic
  • 569
  • 1
  • 3
  • 14
1

You can take a look at http://www.neustar.biz/services/dns-services/managed-dns-packages too. the Enterprise package supports something they call Regional Routing that would be your solution I guess. Same as mentioned before with Akamai offer, the DNS service is smart enough to point to the geographically closest IP.

Piotr
  • 19
  • 1
1

If you are looking for a load sharing solution, then I would recommend Cloud based hosting/Cloud Service Providers.

The Cloud Hosting Servers are designed in a way to do the exact same process as you required by routing to the most nearest host cluster.

Hope this may help in some way.

krisFR
  • 12,830
  • 3
  • 31
  • 40
Tarique
  • 11
  • 1