The Internet provides wide-reach for your website. Content can be delivered across most geographic boundaries. But it is often not realized that geographic seperation causes problems for content consumers. Latencies arise due to the distance between users and the servers where content is hosted. (Latency can also arise due to other constraints, but this article focuses on geographic constraints).
Content Delivery Networks (a.k.a. CDN) are an answer to this problem of latency due to grographic location. CDNs are network of Servers owned by organization who own and place these servers across the Globe. (Not yet in Moon and Mars! #ReminderToElon). These servers are placed at strategic hubs of the internet to ensure closeness and low latencies to the populous regions of the internet world. The content on these servers are replicated on a regular basis across each other. This replication is usually on demand.
When any user requests for content, the CDN-owning organizations have "wizardry" (algorithm), which direct those users to the geographically nearest server. This server provides ("serves") the content. As the server is nearest to the user, the user faces minimal latency.
Popular Websites which use CDNs include Social Media Giants, Search Engines. And of course your name could be a part of this list. You, as a website owner could get the services of such a CDN provider to host your static content (content which do not change per user, and do not change too often).
Some well known CDN providers include:
- AWS CloudFront
- GCP Cloud CDN
- Azure CDN
Some implementation gotchas / points to keep in mind :
- Most CDN providers provide you Host names (DNS Names) which should be used to refer to the static content that is uploaded.
- Create CNAME records in your domain for these Host Names . This will help if at a later point you decide to switch your CDN provider.
- Creating CNAME reocrds in the same domain as your website domain will also prevent some problems called CORS in certain scenarios.
- Static Content such as Videos can also be loaded from the CDNs. But keep in mind DRM concerns if the Rights needs to be protected. Suitable Encryption / decryption will need to be used.
- Realize that CDNs use a LARGE number of servers, so once a file is cached by the network, it is going to spread like wild fire, and will exist for long. Most providers provide a way of cache invalidation which will result in all the servers deleting the cached content (over time) and re-picking the content from the source (your) server. Practically (unless restriction due to constraints such as pricing) it is more easier to create a new file and referring the new file in your web site. This way it is more predictable in ensuring your customers are getting the right content.
- Remember that websites also can be loaded into the CDN. This will ensure your content is as close to your consumers.
Do you have any comments about our article? Or interested in talking more about your specific scenarios? Contact Us
Liked this Article? Subscribe to our Monthly News Letter
At SiteGauge.io we are committed to helping website owners to provide a superior performance to their users. One of our leading initiatives is our Customized Insights Experience Report. This Report captures Page Load Speed bottlenecks your Website Users may face. It is available for Free for a short period. Generate the Report Today.