Why should you use a CDN ?
CDN is the name given to a cluster of servers that are geographically located in different regions to deliver the content of a website to users with the lowest network and processing delay, that is, the fastest.
Many e-commerce and news sites use CDN to keep page opening times low. HTML, JS, CSS, image, video and font files that do not change much from user to user are offered over CDN. CDN pulls such resources from the original server, which it calls origin, and caches them for a certain period of time.
After this point, requests made by users for related resources to CDN are provided from this cached copy. When the cache expires, resources are refreshed with re-requests to origin.
CDN providers host servers in many countries around the world, minimizing the network latency that users will experience. In addition, distributed servers prevent the data center of the relevant site from experiencing congestion.
CDN providers can reduce costs by consolidating because they provide CDN services to many websites on the same servers.
In addition, it is less costly for CDN service as there will be no loss due to corruption of the data held in the CDN. From the perspective of websites, on the other hand, with the use of CDN, large-scale resources are not provided from the data centers and a cost to be paid to the data centers and cloud provider is avoided.
Finally, besides static content, CDN can also cache data that does not change easily and is called reference data (e.g. city, county list).
Similarly, an e-commerce site can keep reference data with a higher frequency of change, such as a product catalog, on the CDN and provide this data for a certain period of time (for example 10 minutes) from the CDN.
When this type of data is changed, a process known as cache reduction is applied on the CDN in order not to wait for the cache to expire, and the cache is forced to be refreshed.