CDN, also known as Content Delivery Network, is a way to distribute web content and assets to the user depending on this geographical location. This means that the closest server to your location will serve you the content. This makes a load-up time faster and reduces the load amount of active connection on the main server due to faster delivery. Here are some CDN services available Cloudflare, Max CDN, Microsoft Azure
Why use CDN?
CDN delivers content faster to the user, this reduces the load-up time of individual files and assets, this is achieved by having multiple copies of data distributed to servers from various locations.
Here is a simple example:
If you live in Asia and the website you are visiting has a server located in Europe, the amount of time it would take to load up a page on the network would be longer, because of the distance between the two locations. This is not noticed when serving small files, but if you are going to download a file as big as 1 GB or larger, you may notice a bit of delay before the downloader connects to the server to request the file and will have a network delay while fetching the content, this is still fine if the file you have requested is not requested by other users, but if there are many people downloading the same file from the same server, it might take a longer time, because the individual server has its own limit to handle requests.
So now let’s see how a CDN can help out.
A CDN will copy the same files to multiple servers located in different locations like Asia, Europe, and America, and depending on the user’s location, it will serve the file, So if you live in Asia, the server located in Asia will serve you the file by detecting the location, while accepting the request made by you. This reduces the delay because the distance in the network is shorter and there are multiple servers to serve content based on location, so now if a visitor from Europe downloads the same file it will retrieve the file from the server located in Europe and serve it to the user. This lets websites like Google, YouTube, and many others websites serve content to a larger audience from various locations with a shorter delay.
But, when do I need a CDN?
When your website is large and has to serve content to a large audience of various locations in a short amount of time. So if you have a blog that gets a good number of views and has the graphical right content and the server can handle it without pain and if there is no noticeable delay in content served to the user, you really don’t need a CDN. Only if you have a lot of traffic, which might delay the web content served to a large number of visitors, or if you have a sudden rush of traffic to every new blog post, that can not be handled instantly by the server instantly, that is when you might need a CDN.
Everything at once
CDNs is good for serving content faster to a visitor depending on their location, this is good for websites that have many visitors and can have large amounts of delay, which might make them lose visitors and can crash the servers, It does not make any sense to have a CDN for a website that gets a decent amount of traffic that can be handled by the server without any pain and does not have large amount data to be served for every request
Thank you for reading,
If you have any questions feel free to leave a comment below.
The image used in the post is by Wikipedia and Unsplash.