Content Delivery Network, CDN
CDN (Content Delivery Network) is a data transfer service (images, videos, web pages, application distributions, patches for programs, etc.) to an unlimited number of users around the world with the maximum download speed regardless of the location of both the content source and its consumer.
The key benefit of a CDN is that organizations do not need to bear the cost of deploying and operating their own infrastructure, software and high-performance communication channels to store and quickly simultaneously provide large volumes of content to a large number of users, especially since the cost of technical support for such infrastructures is steadily increasing as their aging.
How it works
Most users simply leave the site if it takes more than five seconds to open, and in the case of mobile devices, the acceptable latency is even less. It is very important for the administration of any site to attract and retain an audience, because this is a matter of reputation, ratings, and advertising revenue. For online stores, where each visitor is a potential buyer, the issue of retaining and attracting an audience is completely critical. However, most of these web resources open quite quickly, and we practically do not notice any difference in waiting for a response from foreign Internet resources compared to “local” sites physically deployed on a hosting site in our own city.
All this is achieved thanks to CDN technology - a geographically distributed content network. In the classical model, a user requests a web server, and that server gives him the requested content - texts, images, music, videos, etc. When using a CDN this server is called Origin. It is on it that the original data is stored. In addition to it, the CDN has a network of caching servers called points of presence (PoP) or edge servers (Edge). Data from Origin is not duplicated on them, but static content is cached, because, usually it is the most "heavy" and most of all problems arise with its delivery.
When a user sends a request to the server, hoping to receive the desired HTML page with content, it identifies its location by the source data and automatically forwards it to the server closest in geographic location (this operation takes no more than a few seconds). In this case, only dynamic content is usually received from the Origin server, which is generated depending on a specific user request, and static data is sent from the nearest Edge server. For example, when a user sends a request to the website of a travel agency, he makes a request to the database, and it responds by passing information about relevant offers. If the user wants to learn more about the information about each tour and hotel, see photos, read reviews, he is redirected to the nearest Edge server, where all this data is cached. At the same time, the cache is periodically updated to ensure that users always receive the latest content.
Cache only what we need
How does caching work? In response to the request of the first user from a given region, the content comes to him from the Origin server, and then in the form of a cache is placed on the regional Edge server. After that, all users from the specified region will receive cached content from the nearest server. It is also possible to exchange content between caching servers located in the same region, for example, between cities in the Far East.
Set up principles
The CDN service is provided by hosting providers, cloud providers, telecom operators, and CDN companies - CDN providers. There is also a CDN service in the StormWall portfolio.
To order the service, you must select the appropriate subscription plan. Many providers also have free options that are fine for small web projects. To set up a CDN, first of all, you need to transfer the static content of the site to a separate domain like cdn.mydomain.com and configure it, then connect the service with the provider, and with your DNS registrar, reconfigure the CNAME record to the domain of the CDN provider, which it allocates for connection.
As it's already said, an extensive CDN network significantly speeds up the delivery of content, that is, the loading of site content. To feel the difference, it is enough to test this parameter with and without using a CDN, compare it with a regular virtual hosting or virtual server. Usually, gaining even a few seconds when loading content is already a tangible advantage that increases the loyalty of the site's audience.
Using a CDN also helps to reduce the load on the main web server acting as Origin, thereby reducing its resource intensity by deploying it in a more affordable physical or virtual configuration.
Another significant advantage is that the CDN network can withstand very high loads with a sharp increase in user requests - this is especially important for retail chains, large online stores and other resources subject to strong seasonal or other peak loads, for example, during periods of large promotions and sales. This advantage also allows the distributed content network to withstand well-targeted DDoS attacks.
There are several things to consider when choosing a CDN service provider.
First, it's important to compare the CDN provider's points of presence with the geography of your site's audience. For example, if a significant proportion of your users live in Alaska, and the provider does not have PoP in this region, it is better to look for another.
No less important is the bandwidth of the CDN network, as well as the availability of connections with telecom operators at the provider. Usually, large companies with federal coverage have more such joints than relatively small players.
You should also pay attention to the provider's ability to cache not only static, but also dynamic content. You may not need this today, but in the future this service may be very useful for you.
It is of course useful to study customer reviews of a particular CDN provider. It is best to look for them not on official sites, but on third-party sites - in the media, on specialized forums and on pages of independent reviews.