When you visit a website or application, requests are made to the remote server and this server responds back with the data. This transmission of data from the local machine to remove server is done over the public internet and it causes some delay.
Among packet dropping and other networking issues, distance is a key determinant of this latency, the round-trip time required to send a packet of data from one device to another. For example, it takes around 40-50 ms to transmit data from U.S. East Coast to West Coast. The same latency goes beyond 100ms when data is transmitted across the Pacific Ocean.
While we cannot beat the laws of physics and but we can definitely avoid these latencies by reducing this distance significantly. A CDN can help us reduce this distance by caching the static content in multiple servers worldwide, possibly near the location of visitors.
What is a CDN?
A CDN is defined as the Content Delivery Network. In simplest words, a CDN provides the fastest way to deliver content from your website application to the people based on their geographical location. It is a network of geographically distributed servers which caches your static content near the location of visitors. Some well-known examples of CDN are Akamai, Amazon CloudFront, Fastly, KeyCDN and Cloudflare.
Let’s understand this with a very simple example. Suppose that you are accessing a website from Singapore which is hosted on a server located in New York. To render your request, that server will respond to you from New York and it can cause an annoying delay. Now, let’s assume that you are interacting with a website which is using CDN. It has its origin server located in New York along with many edge servers or cache servers (CDN server) present in other locations as well. When you will request the server to display the content from Singapore, it will fulfill your request through your nearest or local edge server, thus reducing the load time and delivering the content in the quickest way. It can also be understood from the below-given diagram:
How does a Content Delivery Network work?
A CDN system has its distributed servers across the globe known as edge servers. And the locations where these edge servers are present are known as PoPs or Point of Presence. A PoP can have multiple edge servers. To understand, how a CDN works, check the following steps:
- A user makes the very first request to access the content of a website such as images.
- The edge servers nearest to the user’s location will retrieve the requested images from the origin server and deliver the images to you.
- The CDN servers will cache those images and save a copy of those images so that if there will be another request for the same content, that will be delivered from the edge servers itself instead of the origin server. Thus, delivering the content in a faster way and taking the load off the origin server.
- If there will be a request for a new content, edge servers will again load that content from the origin server, save a copy and will deliver to you.
Type of Content a CDN can Store
Images: JPG, PNG, SVG, TIF, GIF
Web Fonts: EOT, OTF, TTF, CFF, LWFN, AFM, FFIL, PFM, FON, PFB, SVG, WOFF, STD, XSF, PRO, and more.
Video and Audio: MP4 (HTML5 videos), HLS, FLV (Flash), MOV (QuickTime), MP3, WMV (Windows Media), and WAV
Other File Formats: JSON, HTML, PDF, PPT, DOC, XLS, ODT, EPUB, ODS, ODP, ZIP, RTF
Benefits of using CDN
According to BuiltWith, over 41% of the top 10,000 websites are using a content delivery network. CDNs are extremely helpful for those websites which serve users across the globe.
Using a Content Delivery Network, you can improve your website performance and can avail many other benefits which are:
- The very first benefit of using a CDN is the faster website and the lower latency. If you are using a CDN, you can increase page load speed of your website and can also decrease the latency. We know that a CDN server caches the content from the origin server and serve the users from the nearest edge server, thus if you have users spread across the globe, you can serve them in a faster way.
- If millions of users are requesting your origin server at a time, then it can cause a lot of stress on your server. A CDN helps in delivering the content requested by users through its distributed network of edge servers. Therefore, it reduces the load on your origin server. Your origin server is now more available to do the actual user related tasks instead of busy serving static contents.
- A CDN delivers the user’s request from the nearest server and loads the website content very quickly. It optimizes your website and improves its page load speed. Google loves the faster website and by using a CDN, you can improve your website performance and can get better SEO ranking.
- A CDN helps to keep your website secure from DDoS attacks and web-based exploits. Denial of Service attacks makes your website inaccessible. CDNs can mitigate the effectiveness of such DoS attacks as it has a network of many edge servers and these edge servers can absorb the attack, thus preventing a single point of failure.
ImageKit also uses a Content Delivery Network to deliver optimized images across all platforms throughout the globe instantly. We provide real-time image optimization, image resizing, compression with our global CDN and helps you to improve your website performance. Register for a free trial of 30 days and try ImageKit. Experience a faster website along with many other benefits.