Finally, I found a solution and it works fine.
I put a small static file, for example https://www.google.com/images/icons/product/chrome-48.png, on every server, then download the file from every server and calculate time spent (Calculating Connection/Download Speed is a good way to calculate speed, thanks to @Antonio MG), then save the fastest server host with NSUserDefaults
. Before the app load data from server, replace request url host with the fastest host.
When app launched or applicationWillEnterForeground:
, perform the network speed test. Now, every time at app load data is using the fastest server that just calculated.
Hope this can help those who need it.