What is CDN and how does it work?
CDNs are an important part of today’s Internet, and they’re only going to become more important as time goes on. Even now, companies are hard at work trying to figure out ways to move more functionality to edge servers in order to provide users with the fastest possible experience. This includes a technique called Edge Side Includes (ESI) which is designed to serve partial pages from cache. A good understanding of CDNs and how they work is key to unlocking greater performance benefits for you. Let's dive deep into CDN.
A CDN (Content Delivery Network) is a network of edge servers that provide optimized distribution or delivery of online content. The location of a group of servers is referred to as a PoP (Point of Presence), and each CDN PoP services the users in the geographic area it is placed. This widely distributed and optimized network of edge servers works together to improve the speed and efficiency of content delivery by transmitting data over a private global backbone, bypassing much of the congested public and internet service provider (ISPs) networks.
There is sometimes a misconception about what kind of files can actually be stored on a CDN.
So, here we enlist the file types that can be hosted on a CDN
Images - PNG, JPG, SVG, GIF, TIF
Stylesheets - CSS
Video and Audio - FLV (Flash), HLS, MP4 (HTML5 videos), MOV (QuickTime), WMV (Windows Media), MP3 and WAV
Web Fonts - EOT, TTF, OTF, CFF, AFM, LWFN, FFIL, FON, PFM, PFB, WOFF, SVG, STD, PRO, XSF, and many more...
Other File Formats - HTML, JSON, PDF, DOC, PPT, XLS, EPUB, ODT, ODP, ODS, TXT, RTF, ZIP.
Techniques that a CDN will employ include -
Caching - the CDN will store popular content on servers that have the greatest demand
Load balancing - traffic is shared over multiple servers or web caches.
Request routing - directs client requests to the content source best able to serve the request. This could be the closest node or the one with the greatest capacity.
At a high level, CDN architecture is made up of two key components -
PoPs (Points of Presence) - PoP is the abbreviation of point of presence which refers to the geographical location where a group of CDN servers is located. These are typically spread across the globe to cover a large distance.
Edge servers - The servers located at each PoP are called “edge servers.” Edge servers are actually simple proxy caches, which work in a similar way to the cache in your web browser. They don’t generate the content for the website. Instead, they keep a copy of the content in a cache.
Let's find how a CDN works
When a web browser makes a request for a resource, the first step is to make a DNS request.
the browser gives the domain name and expects to receive an IP address back.
With the IP address, the browser can then contact the web server directly for subsequent requests. There are actually multiple layers of DNS caching, but that’s beyond the scope of this post.
For your simple blog or small commercial web site, a domain name may have a single IP address; for large web applications, a single domain name may have multiple IP addresses.
The server handling DNS requests for the domain name looks at the incoming request to determine the best set of servers to handle it.
The DNS server does a geographic lookup based on the DNS resolver IP address and then returns an IP address for an edge server that is physically closest to that area.
So, the request a clients browser makes to a CDN server has it's DNS looked up at DNS server, which responded with the IP address of the server that's close to the user called "Edge Servers".
Edge servers are proxy caches that work in a manner similar to the browser caches. When a request comes into an edge server, it first checks the cache to see if the content is present.
The cache key is the entire URL including query string (just like in a browser). If the content is in the cache and the cache entry hasn’t expired, then the content is served directly from the edge server.
If, on the other hand, the content is not in the cache or the cache entry has expired, then the edge server makes a request to the origin server to retrieve the information.
When the edge server receives the response from the origin server, it stores the content in the cache based on the HTTP headers of the response.
Missing elements or non-cacheable pages are routed through the Akamai network to another edge server near the host.
That edge server makes the actual requests to the host site and passes them back through the network to the original edge server, and from there they are returned to the end-user.
Since the edge servers are internally communicating using Akamai’s proprietary protocols and routing around bottlenecks, traffic can flow much faster than over the public internet.
Benefits of CDN
Speed is improved not only through the design, distribution, and capacity of the CDN, but also the intelligence and optimizations built into the network. Speed is a key benefit as it is known to have a significant impact on bounce and abandonment rates, as well as the overall user experience. Often speed is measured in response time, which is the amount of time it takes for the server to receive a request and start delivering the requested content.
Scale is equally important to speed. No CDN can deliver quickly and reliably without the ability to scale and handle large volumes of traffic. Without a CDN, a large spike in traffic may cause your server to crash or stop responding. A CDN can generally handle any amount of traffic without slowing down end-users, which takes the load off of the origin server and reduces instances of downtime.
Browser will limit the way you connect to any single domain. You cannot work as fast as you wish, especially when you are downloading large files. You have to wait for one connection to complete downloading so that you can get access to another connection. When you use CDN, this arrangement is different which means that you can carry on with your tasks much faster.
Helps in generating more revenue
A person distracts from your website from poor performance only and this cause for you a loss in generating your revenue. Using CDN makes this possible to sustain that revenue level and helps in generating more and more as you can.
Lower in delivery costs
While improving the amount of revenue generated, CDN’s also lower delivery costs. The loading of all traffic is not placed on a single backbone, it is distributed to edge servers to evenly distribute the load. As a result, the distribution saves on delivery costs.
Free up capacity
Similarly, since CDN’s cause a balance by diverting traffic to edge servers, the capacity available from each server frees up due to a decrease in the number of viewers of specific content. This allows for additional users to access the content.
jQuery is ubiquitous on the web. There’s a high probability that someone visiting your pages has already visited a site using the Google CDN. Therefore, the file has already been cached by your browser and won’t need to be downloaded again.
Distributed data centers
CDN uses a series of localized data centers or edge servers to handle content. This, for instance, allows someone accessing a file in America from Europe to get it faster than when relying on an individual server located in America
Built-in version control
Real-time statistical analysis
CDN’s provide real-time load and statistics, show active regions, reveal which assets are the most popular and report exact viewing information with regards to the customer. Usage details are critical to the success of any webmaster.
A CDN can distribute the load, save bandwidth, boost performance and reduce your existing hosting costs — often for free.
Less low network latency and packet loss
Since CDN’s place servers at popular locations across the globe and feature duplicate content, the latency is significantly lowered because users are almost always close to one of those servers. Similarly, there is less of a chance of sent packets failing because they will arrive quicker and over a shorter distance. This will result in less jitter, significantly improved video streaming quality and fewer network peaks and surges.
Improvement in SEO
According to hundreds of ranking methods of search engines in getting better SEO rank, it is required that your website is faster and responsive, and CDN makes this possible by giving better speed and optimized web pages to search engines.
Web sites are more secure
Because CDN’s use a network of servers with many different websites on them they are constantly attacked in all manner of ways, this has the effect that CDN’s security systems can react instantly to block the person from attacking your website.
Your website 100% online
Because the CDN System is spread all over the world there is no chance of 0.01% of downtime because if one data center is down another will occupies the place of that data center. CDN makes your website 100% Online and it is available all days, weeks, month and the whole year.
It’s easy to set up
If CDN makes you ready to set up and if you are thinking that setting up this cause a downtime for you then be worry-free because setting up it does not down your website for one minute. However, there is a chance that for some seconds it might unavailable but you won’t see it everywhere.
Security has not traditionally been associated with CDN, but it’s become an area of opportunity and increased focus within the CDN industry in the last few years, especially with the massive growth of the internet of things (IoT). Learn how the internet of things is changing cloud security. A CDN provides redundancy, helps protect the origin server and content, and may mitigate or prevent common cyber-attacks, such as Distributed Denial of Service (DDOS) attacks.
Supercharge your website for big files
As we are doing our job online there is a chance that you may use big files on your web pages like very high-quality images, big scripts, and codes. Big files make your site slow and unresponsive sometimes. Here CDN plays an important role by supercharging your website for heavy files.
File mirroring protects data if natural disasters affect certain areas of the Internet. Hurricanes and earthquakes could cause significant disruptions to services in key geographical areas.
Progressive Download and Play
This is nothing else than serving the entire video file to the customer. When the video file is large, the player can already start playing while the file is being downloaded in the background. This is a method that does not allow the time indicator for the player to be moved beyond they already downloaded material.
HTTP Pseudo Streaming
This is a method that tries to mimic Video on Demand (VOD) The video file is broken into small segments and entered as a list in an index file (a .m3u8 file for example). Because the video file is segmented the video player can fast forward when this is supported. Segments that are skipped are not downloaded. Be aware that the segmentation of the video file has to be done before it is placed in the CDN.
This is live material that is broadcasted via the internet. Often HTTP Pseudo-Streaming is meant when live streaming is discussed. Real live streaming via the CDN is customised work, get in touch with us if you want to live stream via the CDN.
It may seem like CDNs are no more than a physical network of servers, but not all CDNs are designed and operated the same. Beyond the hardware are a number of factors that influence how effective a CDN will be at meeting your content delivery needs. Many CDNs have a specific focus or expertise in delivering certain types of content. Consider the ability of different CDNs to work with your internal network and existing systems through APIs and developer-focused controls and user interfaces. A good CDN will provide advanced analytics to show not only your content delivery performance but also the health of the overall network. This should include real-time network latency statistics so you know what’s going at all times.