Using a Content Delivery Network to Improve Website Performance

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, as is 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 the U.S. East Coast to the West Coast. The same latency goes beyond 100ms when data is transmitted across the Pacific Ocean.

While we cannot beat the laws of physics, we can definitely avoid these latencies by reducing the 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 a Content Delivery Network. In simpler terms, a CDN provides the fastest way to deliver content from your website application to the people based in that geographical location.

It is a network of geographically distributed servers which cache your static content near the location of your visitors.

Some well-known examples of CDNs are Akamai, Amazon CloudFront, Fastly, KeyCDN, and Cloudflare.

Suppose 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 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 servers) present in other locations as well. When you will request the server to display the content from Singapore, it will fulfil your request through your nearest or local edge server, thus reducing the load time and delivering the content in the fastest way.

Like this:

Content Delivery Network - CDN


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.

But how does a CDN work?

Like this:

  1. A user makes the very first request to access the content of a website, such as images.
  2. The edge servers nearest the user’s location will retrieve the requested images from the origin server, and deliver the images to the user.
  3. 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, it shall 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.
  4. 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 deliver it to the user.
How Content Delivery Network - CDN works?
How does a CDN work? Image Source: Keycdn

Type of Content a CDN can Store

Can a CDN store videos also, or can it only be used to transfer images?

A Content Delivery Network can store almost any type of content. It can be used to host and deliver images, CSS, javascript, HTML along with 4K videos, and HD videos.

If you have a WordPress website, then a CDN can pull and host anything which is stored in your “wp-content” & “wp-includes” folder.

Following is a detailed list of the content types supported by a CDN:

Javascript: JS
Stylesheets: CSS
Video and Audio: MP4 (HTML5 videos), HLS, FLV (Flash), MOV (QuickTime), MP3, WMV (Windows Media), and WAV

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.

Websites using a Content Delivery Network - CDN
A graph showing that 41% of the top 10,000 websites are using a content delivery network. Image Source: Keycdn

Using a Content Delivery Network, you can improve your website performance and can avail many other benefits:

  1. The very first benefit of using a CDN is a 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 serves the users from the nearest edge server. Thus, if you have users spread across the globe, you can serve them in a faster way.
  2. 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.
  3. 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.
  4. A CDN helps to keep your website secure from DDoS attacks and web-based exploits. Denial of Service attacks make 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 is a global image CDN that delivers optimized images across all platforms around the world instantly. We provide real-time image optimization, image resizing, compression with our global CDN, and help you improve your website performance.

Experience a faster website among many other benefits. Register for free here!