Global Load Balancing Like Google Does
For over 3 months ago, I’ve implemented a Global Load Balancing like Google does.
I’m coming from Indonesia, so that I will take an example if you’re accessing Google from Indonesia
If you’re accessing www.google.com, they will redirect you to the appropriate Google domains in your country.
For me, when I tried to open www.google.com , they will redirect you to www.google.co.id.
I don’t know exactly how does Google redirect the traffic. But what I’ve done is 99% similar like Google.
I already used this on 1 of the websites that I maintaining right now. The subdomain that’s already using this method is http://img.ads.kompas.com
You can try to access http://img.ads.kompas.com/banner/voa_obama.jpg . If you’re from Indonesia, it won’t do anythink (as I described on the Load Balancer). But if you’re coming from out of Indonesia, it will redirect you to http://us.img.ads.kompas.com/banner/voa_obama.jpg
Here’s what I got if accessing from Indonesia
squid:~# curl -I http://img.ads.kompas.com/banner/voa_obama.jpg
HTTP/1.1 200 OK
Date: Fri, 13 Feb 2009 02:30:30 GMT
Content-Type: image/jpeg
Connection: keep-alive
Content-Length: 38558
Last-Modified: Wed, 05 Nov 2008 07:44:08 GMT
Accept-Ranges: bytes
If I’m accessing from US
[root@us1 ~]# curl -I http://img.ads.kompas.com/banner/voa_obama.jpg
HTTP/1.1 302 Moved Temporarily
Date: Fri, 13 Feb 2009 02:31:48 GMT
Content-Type: text/html
Content-Length: 161
Connection: keep-alive
Location: http://us.img.ads.kompas.com/banner/voa_obama.jpg
So it’s almost the same with Google. With this method, I can do the same with Google. Which are redirecting you to www.google.co.id if coming from Indonesia, or redirect you to www.google.co.uk if you’re coming from UK, and so on