How can I determine which server region to have a user connect to? If I have servers in 5 different regions, should I just send out 5 pings and choose the server that got back the fastest?
-
4You should at least explain what it is you're serving, what options you've researched yourself, etc. – Halfgaar Jul 10 '19 at 06:37
-
I'm looking to launch a game in other countries and was considering just having all users connect to American servers, but was concerned about latency. I was thinking about just having the users select which server they want to try, but I am really at a loss on how to handle routing users. – Pfrex Jul 10 '19 at 06:42
-
In short, yes, but this is more a programming question than anything related to server operation. Look up "Gamespy" and "Server browsing" for reference material. – TristanK Jul 23 '19 at 07:53
1 Answers
There are many methods, from using different hostnames in different domains www.example.eu, www.example.au, www.example.cn and the "common" www.example.com or by using subdomains such as www.[eu | au | cn].example.com and setting a cookie that redirects users to a near location, either based on a metric or a stored preference.
The metrics are usually the client ip-address in combination with a IP location database, but also browser accept language, the HTML5 location header or commonly used. Actively letting your server determine which is the optimal server for a specific user by letting each server ping the user's IP-address is uncommon, but may work for your use-case.
More common is using anycast DNS that will direct DNS queries to a DNS server that is (network-wise) nearest to a user and let that nearest DNS server resolve www.example.com to the IP-address of the server that is nearest. Many cloud (DNS) providers provide such a service as part of their offering.
- 80,330
- 24
- 138
- 209