CDN – What is it and How to use it?


It is not today that many companies go through a series of problems related to overload and high demand on their servers.

CDN is the perfect choice for servers that receive massive numbers of accesses simultaneously. In order not to invest in a large physical infrastructure that supports such access, all of that content is placed within a “content distribution network,” which is CDN.

Check out this post with everything you need to know about CDN: what it is, how to use it, and what the advantages are. Good reading!

Understand what the CDN is and how it works

Content Delivery Network, or CDN, is basically a cache layer designated for the process of content that is not subject to interference or manipulation, i.e., static content.

Static content is those that can be stored in a layer outside the server, such as images and codes.

Caching can be done only from the static contents of the site. You can also make a full copy of it in a static way that can be stored in that cache layer, further reducing the server burden, which is the main purpose of the CDN.

Know the main advantages

When it comes to optimizing users’ access to your company’s servers, CDN brings several indispensable benefits to any site with a large volume of access. Ready to know which ones? So let’s go!

Increased network speed

Using a CDN, you spread several action points, which we call pops. They will be scattered across various regions, each serving a different region.

These action points are great for delivering greater, more optimized speed on the network. By having pops spread across multiple areas, when the user is going to connect with your server, it contacts the action point closest to it, providing a more optimized and faster connection.

If we use Facebook as an example, we can see that even if social network servers are located in the US, you can put the content of the cache in specific places, optimizing the side of who visits your site, even if that person is far away from the server.

Ability to handle a lot of traffic

In situations where traffic is very large, CDN can help. When a vote count is made, for example, even if it follows the computation of votes, there is a delay.

Then a request is made for this content to be cached, causing all other visitors to access that content directly from the CDN. This is a strategy for servers to deal with this absurd amount of traffic.

During the attack on the twin towers, for example, there was a drop in the UOL, Terra, and IG sites. At that time, CDN did not have the capacity to handle the large volume of accesses.

These problems no longer exist today. If we analyze an image of Facebook, for example, we will see that it comes not from Facebook servers, but from a CDN.

With about one billion users, it would be virtually impossible to deal with so many people accessing at the same time if there were only social network hosting servers.

So with the CDN option, the company distributes pops across multiple regions. Continuing to use Facebook as an example, there are Facebook action points here in Brazil, which prevents server overhead and optimizes access on our side.

Protection against DDoS and Script attacks

CDN itself has no direct link to anti-DDoS. However, because they are close products – and both deal with access and network traffic management – most companies, contract the two services, with anti-DDoS only an additional one.

Another tool that can be used as an additional security for the network is the WAF (Web Application Firewall).

Basically, this system stays between your site and the rest of the internet. It works as a kind of barrier that protects the server from attacks from Spammers, Hackers, DDoS, and other forms of cyber attacks.

Like anti-DDoS, WAF is just an additional CDN, which is usually hired along with it to give the proper protection your server needs.

Learn how to use the CDN

The CDN can be used basically in two ways. The first one is being used only to store the static content of your site; the second is used as a reverse proxy to contain a static copy of the entire site. Let’s understand how each of these methods works.

Serving only static content

This way of applying the CDN is to make the storage and distribution of resources that are not changed frequently on your site – the static resources.

Examples of features like these are images, scripts, style sheets, etc. In this way, the server will continue to serve the requests of the users, but the static content will be provided by the CDN.

Here, you need to create a subdomain and direct it to the distribution network. After that, the site must be configured to load static content from that new address.

In that case, only part of the content will be provided by CDN. Traffic remains 100% targeted to the hosting server. That way, a portion of the server load is reduced, decreasing its burden.

Storing a Full Site Copy

In this methodology, a reverse proxy configuration is made in the CDN. With that, the DNS of the domain should be pointed to there.

In this way, all site traffic is then directed to the servers in the content distribution network.

Here, CDN caches a static copy of the entire site. In cases where all the resources needed to present the site are cached, no requests are made to the server, sending a response to the user coming from 100% of the CDN.

If there is a resource that for some reason, is not cached, only the resource will be directed from the hosting server.