Our literature altert app Stork has many users in US, Europe, China and other regions. Our server was located in US West (silicon valley), and it had been fast for all users. But in March, 2020 we got more and more complaints from China users that it was slow to load our website and sometimes the connection even failed.
We needed to find a solution. There were a few options, from easy to difficult:
- We can migrate the server to a location where both China and US users can access reasonably fast. Still single server and the same domain name.
- We can have one server in mainland China (say Beijing) serving China users only, and the US server to serve the rest of world. We use the same domain name but make it “smart” so it redirects users to the appropriate server.
- Similar to #2, but we use two different domain names, one for China and the other for the rest of the world.
Obviously option #1 is most attrative given its simplest technical demand. To look for such an ideal location, we created 8 test servers in different locations and test the connection from US West and China (Beijing). Here is the result:
And the same data in a table (numbers are latency in seconds):
Server Location | From US West | From Beijing |
US West | 0.8 | 39.0 |
US West | 4.3 | 32.3 |
US West | 0.1 | 34.5 |
China (Beijing) | 737.1 | 4.4 |
Local | 0.1 | 0.1 |
Hong Kong | 3.4 | 0.7 |
China (Beijing) | 22.0 | 0.1 |
Sigapore | 1.3 | 2601.7 |
Tokyo | 0.7 | 1104.0 |
We can see that the connection from a China user to most other countries is very slow, and connection from US to most other countried are fast except to China. So internet wise, China and US are practically disconnected!
The latency between China and US (West) is dependent on time. In the plot above, you can see that the latency is actually fairly small during the night time in China, but very large during China’s day time (note that the unit of the time in the above plot is UTC). The variation of latency suggests that we can’t measure the connection speed just at one time point.
But there is one exception which gives us hope. It’s Hong Kong! Its connection to Beijing is fast, and to US is reasonable. So it’s a good choice to choose Hong Kong. Actually we did this and the result is pretty good. Both our China users and users from other regions can access our website reliably and reasonably fast.
So if you have a significant number of users or customers in China, you may consider to host your web server in Hong Kong. Currently both AWS and Alibaba Cloud offer Hong Kong servers.
Lesson Learned:
- Hongkong is the ideal location to host your web servers if you care China market
- US-China internet is practically disconnected during China’s day time