It has been a long time since I last wrote a blog post. In the past few days, I updated the architecture of Infinite Script to accelerate the speed for Chinese users. In this article, I share the new architecture of our website with you.

Optimizing a CDN for Static Content Delivery

Static content does not change over a period of time. If it does change, the changes are predictable. Static content includes images, CSS sheets, JavaScripts, and PDFfiles. Because of this, CDNs can cache a copy of the content at their edge servers.They can thenserve it whenever a client requests it. CDNs are best at optimizing the delivery of static content from edge servers to users. Therefore, we use the CDN from Alibaba Cloud.

As we all know, the edge servers in CDN need to get static files from the original site if a file is not cached by them. The original site is located in the US, so it takes a long time to get files from the original site for edge servers in Mainland China.

To solve this problem, we create a secondary cache server for edges servers in Mainland China. We use the Elastic Compute Service (ECS) provided by Alibaba Cloud. The original site is set to this secondary cache server for edges servers in Mainland China. Of course, this secondary cache server is located in Mainland China.

The secondary cache server works with the same principle as the edges servers do. If the requested file is not existing on the server, it fetches the file from the server located in the US and then saves it on the disk. There is an index.php in the web root directory for handling uncached files.

Optimizing a CDN for Dynamic Content Delivery

WordPress is based on PHP and relational databases (e.g., MySQL). The pages are dynamically generated when users requested. Generating pages from PHP is not time-costing, however, connecting to the server hosting WordPress takes a long time for users in some regions of China.

We generate a static version of the WordPress website with WP2Static. Then, the static version is pushed to a CDN service powered by UpYun. You may ask why don’t I use Alibaba Cloud CDN here? Because UpYun provides an FTP service which can easily be integrated with WP2Static.

So, for Chinese visitors, they will see a static version of the website. Therefore, the search function is not working in the static version. The comment system of WordPress has been replaced by Disqus several years ago. Unfortunately, this website is blocked in Mainland China.

In future work, I will solve the problem in searching and commenting for users from Mainland China.

The Disqus comment system is loading ...
If the message does not appear, please check your Disqus configuration.