How CDNs work
Content delivery networks operate in two main scenarios:
- The nodes in the network cache certain data (which is often requested by users) and each time serve it on request without contacting the origin server.
- Content from the source server is distributed to all network nodes, and from them - to users' computers.
In the first case, CDN nodes "intercept" user requests to speed up data transfer while reducing the load on the main server.
In the second case, information is broadcast in real time for all users, geographically distributed by regions, countries, continents.
Technology advantages:
- fault tolerance is maintained through the distribution of heavy content types when the web resource receives a heavy load;
- provides more reliable and faster, with lower delays, communication with geographically close consumers;
- unloads the main web server.
One of the significant advantages of the technology is the ability to separately configure, scale, serve the distribution of statics (CDN) and the server with the application business logic (API). With the help of a CDN, it is quite simple and effective to scale a content distribution network. In many cases, this is an inexpensive solution well tailored for its task.
How CDN works
CDN for commercial sites
Does the average commercial website need a CDN with slow download speeds? Most likely no. The content delivery network will not solve the technical problems of such a resource, although it can correct some of the default settings (if the network operator provides such services).
But the main functions of a CDN are not in technical optimization, but in the substitution of "crutches" for transferring heavy content and distributing data over long distances. Most business websites don't need this:
- they do not broadcast online to a wide audience;
- there is usually not too much distance between their users and the server;
- they don't serve out heavy content.
For example, videos are uploaded by third-party services (YouTube). And the geography of data transmission is often limited to one federal district - at such a distance, the physical loss of speed is too small to significantly affect the speed of loading sites.
It turns out that for commercial Internet resources with the absence of specific static content from the CDN, there is no benefit.
CDN harm to the site
Can a CDN harm a website? Easy, and there are many examples.
First, by choosing a CDN, you get an additional latency point, because now the system becomes more complicated by connecting another node, and this entails new waste of resources and delays.
Second, a CDN is also a potential point of failure. Therefore, before connecting, you should find out: where the node is located, how routing is configured in the system, and whether site errors will occur.
With all this, you have to pay for the services of the content delivery network. And the fee most often depends on the volume of transmitted traffic. You will have to additionally control the amount of data in order to plan your budget.
Server equipment
What problems CDNs don't solve
The speed loss due to the distance of the server from users is usually insignificant, and many business sites do not have heavy content. But there are other acute problems that are critical for the speed of the Internet resource:
- unoptimized images;
- heavy and unnecessary code;
- incorrect connection of JS and CSS;
- errors in database configuration;
- insufficient server capacity.
The CDN operator, in theory, can negate mistakes made during development and in server settings. But this is one-time work that is advisable to be carried out on the side of the site - it is more profitable and safer.
There are many proven acceleration tools out there, including server-side caching, using Nginx and Apache, CSS and JS minification, preloading key content, photo and text compression, data compression, and more.
If the site is developed by experienced specialists and has passed technical optimization, it is quite possible to do without a CDN.
CDN - for whom?
Many content delivery network stations have been built in the world. They are located on all continents, in various regions, countries and areas. CDN services are in demand - from whom?
The main users of content delivery networks are projects working with large and heavy data, including on a constant stream. Many large companies build their own stations through which they broadcast information to a wide audience. For them, CDN technology is irreplaceable.
The site of a company operating in the Moscow region with a server in the Moscow region does not need content delivery networks services. And the problem of slow loading is solved once - by carrying out technical work on the resource itself.