Web Performance in China - Best Practices
Delivering fast and consistent web performance within mainland China can be a challenge even for the most experienced technology pros, and with a population exceeding 1.3 billion people it is becoming more important by the day. In fact, according to Mashable, there are now as many internet users in China as there are people in Europe.
If your website is slow behind the firewall (or times out completely) you are now missing out on nearly 735 million potential customers.
So, what is that's so difficult about delivering a good user experience in mainland China? The answer is complicated, but it comes down to a few main issues:
- Government regulation – the Chinese government tightly regulates what can be seen on the Internet in mainland China. Businesses outside of China need a special license to serve content from within the Great Firewall and this can be revoked at any time for just about any reason. Many of the largest companies in the world like Facebook, Youtube, and Twitter are blocked completely.
- Size – China is huge. Even if you’re able to host your website or application inside China it won’t be fast everywhere in the country due to distance and poor peering connections.
- Mobile – a significant portion of the Chinese population does not have access to broadband and rely exclusively on their smartphones to access the Internet. If your site is not highly optimized for mobile it is likely timing out for this large section of the population.
This may sound intimidating, but there are a few simple things you can do to dramatically improve the online experience for your audience China:
1) Create a new (sub)domain
If you have traffic in China the first thing you’ll want to do is create a separate domain or subdomain specifically for your Chinese users. This serves a few purposes. First of all, you’ll want to remove any 3rd party objects from this domain that might be banned in China. This can be advertisements, analytics tools, social media widgets, etc (remember, even Google and Facebook are blocked). In general, the fewer 3rd parties on this domain, the better. And for any 3rd parties you choose to keep, be sure to use web performance best practices and load them after your own content so it doesn’t delay rendering of the important parts of the page. It's pretty common for sites to time out completely due to poor placement of a blocked 3rd party object. Creating a separate domain for your China traffic can also help deliver some cost savings when buying CDN since that traffic is far more expensive than other delivery regions.
2) Use an appropriate CDN
Anyone doing business online in 2018 knows that a good CDN is one of, if not the most, powerful tools your web performance utility belt. What they may not know is that many CDNs today still have limited POP coverage in mainland China. And even if your CDN does offer delivery in China, you don't get access to it by default. First off, you will need to register with the Chinese government and get an ICP license. You'll also pay a hefty premium for that bandwidth in most cases. If you don't have an ICP license and you have traffic in China today, your CDN is actually serving those users from Hong Kong. And while this may seem close enough, it's outside the Great Firewall, which means your site will still be incredibly slow by the time it reaches the mainland.
The fastest CDNs in China, according to Cedexis benchmarks, are ChinaCache and QUANTIL/ChinaNetCenter. These companies both offer significant POP coverage within China and have offices in the US that can give you local support in English and even help you get the appropriate license to deliver your site content there.
Note that traffic in China is more expensive than any other geographic region. If you want to reduce your costs you may want to consider a dual-CDN strategy where you run only your China domain on ChinaCache or QUANTIL and the rest of your traffic over your primary CDN.
3) Optimize your site
As previously mentioned, most people in China will be accessing your site from a mobile device. This means you absolutely must optimize your site for mobile and do what you can to reduce your page load size. The obvious first step is to optimize your images, but you can also minimize and inline Javascript and CSS files and remove any unneeded objects from the page.
Caching is another factor that can have a big impact. Most sites these days use content management systems that tend to generate HTML for each individual visitor, even if that isn't necessary. Every time this happens the request has to go all the way back to your origin, resulting in significant delays. For this reason, be sure to utilize full page caching whenever possible. When it comes to delivery in China (and other difficult regions, like South America) the more you cache, the better, and you'll likely want to have longer TTLs even if it means means sacrificing some of the more dynamic/personalization features of your site.
If you want to see how your website is performing within China you’ll need a monitoring solution with endpoints in the area as well. Like with your CDN, the more nodes the better since China is huge and performance can vary greatly from one city to another. Catchpoint is a great option for this since it offers over 50 monitoring locations across China, covering most major cities and ISPs.
Final Considerations
The 3 steps above will set you well on your way to delivering a solid user experience for your customers in China, but there are a few other things to consider:
First, be sure your website is backward compatible with older browsers. A large percentage of Internet users in China use older devices which may not be updated with all the latest browsers and plugins. If you don't want to give up all your cutting edge tech you can create a separate stripped down version of the site just for these users. Your CDN should be able to detect which device the user is connecting with and route them to the appropriate site.
Second, be sure to make use of the security services offered by your CDN (or other cloud security provider of your choice) to protect your site against DDoS attacks, application attacks, and malware. Research shows that nearly 30% of all cyber attacks are initiated in China. Anyone selling online in 2018 should be using a WAF, but this is especially true for those selling in China.
The steps outlined in this article will allow you to drastically improve your web and mobile performance without having to set up hosting behind the firewall. That said, there is no way to avoid going back to origin for certain requests, and the farther away your origin is the slower your site will be. If you have a highly dynamic website or application that isn't easily cacheable, you should consider hosting it with one of the public clouds that do business in China like Alibaba Cloud, AWS, or Microsoft Azure. All three companies have offices in the US that can help get you set up, but again, be prepared to pay a hefty premium over what you'd be paying in the US and keep in mind that your site can be blocked at any time. If you do go this route, you should still use an appropriate CDN since peering connectivity in country is not ideal and your site performance will drop off quickly with distance.