Content Delivery Networks (CDN)
A content delivery network is a globally distributed network of proxy servers serving static content such as images, videos, html/css/js files from the location nearest to the user. The sites dns resolution will tell clients which server to contact. It leads to decreased latency in fetching the content and reducing load on the main server for the request fulfilled by the cdn server. There are two types of CDNs:
- Push CDNs: Push CDNs recieve the content whenever theres a change in the main server. Here we are responsible for managing the cdns data such as uploading data to cdn, rewriting url to point to cdn, revoke old cdn data, etc. These are good for sites with low traffic and that doesnt need to change frequently
- Pull CDNs: Pull CDNs grab new content from the main server when the user request for data and the content is cached on the server for a time period marked by Time To Live(TTL). This makes sure to reduce storage space but can make redundant traffic if the file expires but hasnt changed thus making a full request to the main server. These are good for sites with high traffic as traffic is well spread out more evenly with only recently requested content remaining on the cdn.
Disadvantages
- Extra cost for cdn servers
- Content might be stale if it is updated before TTL expires
- They require changing urls for static content to point to the cdn.
