Were you ever curious about why large websites load their pages quicker. Sure, they have high performance dedicated servers, but they also use a globally distributed network called Content Delivery Network (CDN). This article will introduce you to the concept of CDN, how it works and how it can be configured on a Joomla website or in other words how to perform a Joomla CDN integration to help improve website content delivery speeds and reduce latency.
What is a Content Delivery Network (CDN)?
A Content Delivery Network (CDN) is a globally distributed network of web servers or Points of Presence (PoP) whose purpose is to provide faster content delivery by replicating the content and storing it on multiple CDN Servers. That way, the user can access the data from a server that is in the nearest geographical location. This has proved more efficient than storing content on just one central server. Clients accessing copies of their data on the multiple CDN servers will help avoid bottlenecks near that central server.
Without a CDN, central servers must respond to every single end user request. This results a subsequent load, thereby increasing the chances for central server failure if the traffic spikes are exceedingly high or if the load is persistent.
How does a Content Delivery Network (CDN) work?
Nowadays, web pages are quite complicated and complex; one feature being that the entire content is too big to be downloaded at once. The browser on the user's personal computer or smartphone makes multiple requests to the central web server where each of these requests takes a few milliseconds only to get a response.
Moreover, the further away the central server is located, more intermediate nodes or networking devices that multiply requests time will be inevitable. Subsequently, hundreds of requests are placed to the central server for a single webpage to load up completely. This not only increases the server load but also increases the latency.
Therefore, a website that applies Content Delivery Network (CDN) technology bridges the physical distance between the central server and the users’ personal computers. For example, a user is requesting a webpage from Saudi Arabia. The requested web page’s central server is located in the United States and there is a CDN server located in Switzerland.
What are the Content Delivery Network (CDN) Pros and Cons?
The Pros of using CDN are:
- Web pages load quicker. 网页加载速度更快。
- Better user experience. 更好的用户体验。
- Reduce server bandwidth. 减少服务器带宽。
- Lower server load. 降低服务器负载。
- Increase in concurrent users on the central server. 中央服务器上并发用户的增加。
- Geo-location of the content. 内容的地理位置。
- Faster content delivery to the users’ browsers. 更快地将内容交付到用户的浏览器。
While the Cons of using CDN are:
- Incorrect configuration of the CDN might cause viewing errors. CDN配置不正确可能会导致查看错误。
- Cost additional expenses. 成本附加费用。
- Adds complexity to your website and deployment procedures. 增加网站和部署程序的复杂性。
- Network filters might block some Content Delivery Networks and prevent your website content from being loaded. 网络筛选器可能会阻止某些内容交付网络，并阻止加载您的网站内容。
- Geo-location might actually be further away from your targeted audience. 地理位置可能实际上更远离您的目标受众。
What are the two types of Content Delivery Network (CDN)?
There are two different types of CDNs: push and original pull (or simply 'pull'). Each has its own advantages and disadvantages. Some sites work best with push CDNs, and some work better with pull CDNs.
Using a push CDN server, the site owner is required to upload website content (automatically or manually) directly to the CDN server and link that content to the website. The site owner, or the primary server, takes responsibility for providing the content to the CDN server, which in turn pushes it to the network. This is flexible as site owners can specify the content that is uploaded, when it expires and when it should be updated. This method is also the most efficient in terms of how the traffic is used. Content is uploaded only when it is new or changed, thus keeping traffic to a minimum.
On the contrary, an origin pull CDN works very differently. The site owner is not required to upload files onto the CDN, the CDN does it autonomously. The site owner leaves the content on the central server and rewrites the content URLs to point to the CDN server. When the visitors ask for a specific file, the CDN server will first go to the central server, pull the file and serve it. The CDN server will then cache that file until it expires. People who are trying to access a file for the first time, or accessing it after it has expired, may notice a small difference in speed. Setting the expiration correctly can help to minimise this problem, but it can involve trial and error.
How to Implement a Content Delivery Network (CDN) in Joomla?
We already mentioned the two main CDN types, which were Push and Pull CDNs. Both of them have their advantages depending on the setup of your website. The Pull CDN is the one which is great for most of the Joomla sites and there is not much initial setup and maintenance needed.
We will now introduce to you some tips on how to implement the Pull CDN. You can start with choosing a CDN provider from the list shown in the below sections, and creating an account with them. Now establish the DNS redirects while reading the instructions given by the provider. Once the cdn.yourdomain.com points at your CDN account, it’s all good.
Choosing a CDN Extension:
The Joomla CDN extensions can be found in the Joomla Extensions Directory, just go to Core Enhancements > Performance category or you may choose one from the below list according to your needs in order to set up the CDN integration:
- CDN for Joomla by RegularLab RegularLab为Joomla提供的CDN: Any CDN that supports pull-zones. ：支持拉区的任何CDN。
- JomCDN by CorePHP 由CorePHP开发的JomCDN: Only for Amazon S3 / Cloudfront and StackPath. ：仅适用于亚马逊S3 / Cloudfront和StackPath。
- JCH Optimize JCH优化: Only for Amazon Cloudfront and StackPath. ：仅适用于亚马逊Cloudfront和StackPath。
Setting up these extensions is usually pretty easy to do, depending on which one you choose. You may find other extensions which might fit your needs. Make sure to check extension documentation for further information.
Choosing a CDN Provider:
You may choose one of the popular CDN providers listed below. Be noted that some of them are free with limited features while others should be purchased as subscriptions in order to benefit all CDN features.
- Amazon CloudFront 亚马逊云锋
- Azure CDN (Microsoft) Azure内容分发网络（Microsoft）
- Cloudflare 云耀斑
- BunnyCDN 兔子CDN
- CDN77 CDN77蛋白
- CDNetworks CD网络
- CacheFly 高速缓存
- KeyCDN 密钥CDN
- StackPath (previously MaxCDN) 堆栈路径（以前为MaxCDN）
CDNs serve a great purpose, they reduce significant traffic to the central server and improve the web experience which benefits both the content provider and the end users.
I hope you find this explanation of Content Delivery Networks helpful. A CDN requires extra configuration and extra expenses but the benefits are well worth it especially if you have users located all around the world.