CDN
Accelerate WordPress with CDN and Cache Servers
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, illustrated in the figure above. 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 PDF files. Because of this, CDNs can cache a copy of the content at their edge servers. They can then serve 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.
Use CDN Service in Spring MVC
When I deployed TestZilla on Aliyun Elastic Compute Service, growing traffic made it worth offloading static files (images, CSS, and JavaScript) to a CDN. At the time there was little guidance on wiring a CDN into Spring MVC, so I asked on Stack Overflow and ended up with the setup below. The idea is simple: keep the CDN host in a single property and inject it wherever your JSP views reference static assets.
Create CDN View Helper in Zend Framework 2
In this article, you will learn how to create a custom view helper in Zend Framework 2. A concrete example will be used; a helper which generates links for a subdomain, intended for storing static files. This is especially useful if you wish to use a Content Delivery Network (CDN). With very little modification, the helper can be made generic to support links to subdomains for all purposes. Note: Zend Framework 2 has reached end of life. In 2019 the project moved to the Linux Foundation and was renamed Laminas, so the Zend\ namespaces below are now Laminas\ (for example Zend\View\Helper\AbstractHelper becomes Laminas\View\Helper\AbstractHelper). The view-helper mechanics are otherwise unchanged, so this post is kept as a historical walkthrough. For a real project, run the namespaces through the Laminas migration guide and follow the current custom view helper docs.