Jump to content

Automatically choose nearest server for guests

Recommended Posts

One small issue that catches me out from time to time is where TestMy chooses Dallas, Texas by default.  This generally is not a problem on a PC as I can clearly see the chosen server at the top right.  However, when testing on my mobile, it doesn't show the current server unless I go into the "Server Selection" page and I remember one day doing tests in one town only to realise it lost my Cookie and ran all the tests with the Dallas server.  :???:


When I ask people to run a speed test, the main workaround I use is to ask them to use the URL http://uk.testmy.net/ which forces the use of the UK server.


If it's straight forward enough to work out the country from the user's IP address, one nice feature would be to have TestMy automatically pick the nearest server when the user is not logged in and the cookie has no been set (i.e. first visit to TestMy).


For example, if my cookie expires or I use a PC / browser for which I'm not signed in, it will generally switch back to the Dallas server, even though my nearest server is London, UK.  The following is an example where I opened a private browser window and went to TestMy.net to simulate a first time visitor:



Share this post

Link to post
Share on other sites

Look closer at the mobile version.  Scroll down a bit and look in the lower right.  You can see the server's icon.




Mine is showing "Dallas - iPhone Detected" 


As for automatically selecting a more appropriate server, TMN does this already too, based on your detected country.  IE is one that's sent to the UK servers.  Here, I'll just share the current country arrays.


$arrayEurope = array("AL","AD","AT","BY","BE","ES","BA","BG","HR","CY","CZ","DK","EE","FO","FI","FR","DE","GI","GR","HU","IS","IE","IT","LV","LI","LT","LU","MK","MT","MD","MC","NL","NO","PL","PT","RO","SM","RS","SK","SI","SE","CH","UA","GB","VA","RS","IM","ME");
$arrayEuropeB = array("DE","DK","NL","CZ","PL","BY","RU","FI","EE","LV","LT","SE","AX","RO","BG","CH");
$arrayAfrica = array("DZ","AO","SH","BJ","BW","BF","BI","CM","CV","CF","TD","KM","CG","DJ","EG","GQ","ER","ET","GA","GM","GH","GN","CI","KE","LS","LR","LY","MG","MW","ML","MR","MU","YT","MA","MZ","NA","NE","NG","ST","SN","SC","SL","SO","ZA","SH","SD","SZ","TZ","TG","TN","UG","CD","ZM","TZ","ZW","SS","CD");
$arrayMiddleEast = array("AF","AM","AZ","BH","GE","IR","IQ","IL","JO","KW","LB","NT","OM","QA","SA","SY","TR","TM","AE","YE","PS");
$arrayAustralia = array("AS","AU","NZ","CK","FJ","PF","GU","KI","MP","MH","FM","UM","NR","NC","NZ","NU","NF","PW","PG","MP","SB","TK","TO","TV","VU","UM","WF","WS","TL");
$arrayAsia = array("BD","BT","BN","KH","CN","CX","IO","HK","IN","ID","KZ","KP","KR","KG","LA","LB","MO","MY","MV","MN","MM","NP","PK","PH","SG","LK","TW","TJ","TH","UZ","VN","RU");
$arrayAsiaB = array("IN","ID","NP","SG","MY","VN","MM");

Defaults associated with those arrays
$arrayEurope = uk.testmy.net
$arrayEuropeB = de.testmy.net (overrides previous default)
$arrayAfrica = uk.testmy.net
$arrayMiddleEast = uk.testmy.net
$arrayAustralia = au.testmy.net
$arrayAsia = cn.testmy.net
$arrayAsiaB = sg.testmy.net (overrides previous default)

Everywhere else defaults to dallas.testmy.net

Note: Dallas, UK and DE being the most popular locations have arrays of servers to meet demand.  We still often call it, "the Dallas server" ... but it's not just one server.


If you see that I've missed any countries please point them out.


You test a lot of different connections, some of them may be detected as "Unknown".  The country identifier is very reliable but there are still instances where it isn't able to be resolved.  In those instance you'll be defaulted to Dallas... unless you're signed in and have already previously chosen another server, in that case the default is overridden to your choice.  As long as you're signed in your server selection will follow you... that's a database driven setting.


For the most part, when you share "testmy.net" with your friends they'll be defaulted to an appropriate server.  If you notice otherwise go to https://testmy.net/database and see what the detected country is.  If it's detected and still defaulting you to Dallas PM me the IP address and I'll be happy to look into it.

Thanks for all your support, suggestions and questions. :occasion14:



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Speed Test Version 15.9
© 2018 TestMy Net LLC - TestMy.net - Terms & Privacy
© 2018 TestMy Net LLC - TestMy.net - Forum - Terms & Privacy