5

I have a website that has users from both Hong Kong and Australia.

Unfortunately, since the server is located in Australia, users from Hong Kong are going to suffer latency problems. Traffic has to go through US before travelling back to Australia.

So I've setup a server in Hong Kong as well, and users using the .hk TLD are going to be redirected to the Hong Kong web server. It shares the same database server with the Australian server but due to aggressive SQL query caching, impact on performance from latency from SQL queries are negligible.

But for users accustomed to the Hong Kong website but have since traveled to Australia, they suffer from additional latency because they go to the .hk site which redirects to the HK server even when they're in Australia. The website is targeted at international students from Hong Kong so this is an significant issue for me.

Instead of redirecting users to the closest web server based on the TLD, how do I redirect users based on their location?

Currently I am using nginx, postgres and Django. Say I know how to estimate users' location based on users' IP addresses, what is my next step? At what level would I work on? What topic should I read up?

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
Eric
  • 153
  • 3

1 Answers1

3

One option is to use the GeoIP module in nginx and redirect your user to the appropriate site. In this scenario the request will be slow till redirected to the appropriate site.

Second option is DNS. Use Geo DNS based solution. You can read more about it in this thread. GeoDNS doesn't work in case the users use Google DNS or OpenDNS

Sameer
  • 4,118
  • 2
  • 17
  • 11
  • "In this scenario the request will be slow till redirected to the appropriate site. " Do you mean every request from a browser session will be slow until redirected to the appropriate site, or just the first one? – Eric Dec 13 '12 at 04:25
  • The first request till you redirect it to the appropriate webserver. – Sameer Dec 13 '12 at 05:04