Summary
Due to lack of available CDN in China from Apache, MXNet website is hosted in Japan for Chinese visitors [1]. According to the Q1 2020 Google Analytics report, it took 20 second on average to load the website in such areas and the traffic from China declined by 16% compared to previous quarter. An alternative CDN solution is discussed in this proposal.
Introduction
MXNet website is the one-stop site for users from all over the world to explore MXNet project. As a part of Apache Software Foundation, MXNet official website is hosted by Apache on its content delivery networks. Because MXNet dev community has no access to Apache’s web server, Google Analytics is used as the tool to track and report website traffic. Based on the statistics from Google Analytics, we are able to better understand our users and improve MXNet website.
Problems
According to the statistic (Q1 2020) from Google Analytics, China has the most users using MXNet website which account for 22.95% of the total number of users. But the website load time is very slow in aforementioned area, the average page load time is 20.38s compare to US it is 2.12s.
The cause of this problem [1] is, according to Apache Infra team, MXNet website is served from Japan for Chinese visitors. Due to the Great Firewall of China [2], it can cause long delay on visiting oversea websites. But at present Apache can not get access to serve from China itself by reason of Chinese government regulations.
This can cause frustration on our customers in China, and in Q1 2020 there is a 15.69% decline in traffic (measured by sessions) from China compared to previous quarter.
Proposed Solution
Based on what Apache Infra team can offer now, this is a compromise solution that can address this issue. A Chinese CDN which is pointed by a different but similar domain name ‘mxnet.cdn.apache.org’ is set up by Apache Infra team. It is a Chinese CDN provider and there is a huge improvement on website loading speed in China, as shown below.
To achieve optimal results, this project is scoped into two parts, both of which aim to increase the usability of MXNet website and provide better user experience.
Part 1. Redirect Chinese Visitors
Perform a server side redirect by checking Accept-Language header of HTTP requests when users initially attempts to access the website. This is a fast and relative accurate approach which can avoid the client side loading and subsequent redirect.
Solutions not considered:
- Use Apache server side 3rd party Geo iP based redirect module - more accurate filter to visitors, but is not likely available to use, for Apache only offers limited modules for incubator project websites to use
- Check browser navigator.language - Server side redirect can achieve same function with faster speed
- Use browser Geolocation API - Accurate, but much slower and need users’ permission to get related data
Part 2. Improve Overall Website Loading Speed [2]
- Eliminate render-blocking resources, defer or lazy-load resources that is unrelated to first render
- Update cache policy for static assets
Reference
- Slow site speed issue Jira ticket: https://issues.apache.org/jira/browse/INFRA-20203
- Impact of Great Firewall of China: https://mlytics.com/blog/why-your-website-is-slow-in-china/
- Google PageSpeed insight: https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fmxnet.apache.org%2F&tab=desktop
- Discussion about certificate expiration problem of Apache’s experiment CDN: https://issues.apache.org/jira/browse/INFRA-20185?focusedCommentId=17096119&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17096119
- MXNet Chinese CDN URL: https://mxnet.cdn.apache.org/
- Quip proposal link: https://quip-amazon.com/ydttAOKE2CkL/MXNet-Website-20-Slow-Site-Speed-in-China
Appendix - Alternative Solutions not Considered
Based on the response from an Apache Incubator project “EChart” whose team also faced the same problem, and previous Apache Infra Jira tickets discussing similar issues, below two solutions are not considered any more.
Apache Experiment CDN
According to EChart team’s response [4], Apache Infra once moved EChart website to the experimental CDN in China. But there was an unexpected certificate expiration issue popping up, Apache Infra team was not able to address the problem and had to move the website back to previous CDN.
This experiment CDN is not recommended by Apache Infra team.
Deploy Mirror in China
Not recommended/permitted by Apache Infra team