What is a CDN and how to Implement a CDN in Joomla
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.
Below is a CDN map view which shows a clear demonstration of how CDN servers (Edge Servers) can bridge the distance between the users and central server (Origin Server).
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.
- 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: Any CDN that supports pull-zones.
- JomCDN by CorePHP: Only for Amazon S3 / Cloudfront and StackPath.
- JCH Optimize: Only for Amazon Cloudfront and 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)
- StackPath (previously 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.
Do you have questions? Post them in the comments section and I will be happy to help.