Content Delivery Network - rishavry/WorksPresentation GitHub Wiki

  • A Content Delivery Network (CDN) is a distributed network of servers that caches and delivers content closer to users, improving website load speed and reducing latency. It essentially has a bunch of caches spread out in different locations, and each cache stores a bunch of files; whenever a user makes a request to a potential file in the CDN, the DNS sets the ip-address to the CDN-domain of the cache that's nearest the user.

  • In my Megagram project, I would use a CDN for caching and delivering images, videos, JS-files, JS-scripts, and just about any non-private file in-general.

  • Linked below are the in-depth steps, published by the makers of Cloudfront themselves, I would take to implement a CDN using AWS Cloudfront.

https://aws.amazon.com/getting-started/hands-on/deliver-content-faster/.

  • Now, do I have the instructions above memorized? Do I need to type in each of the steps into this document? Absolutely not, and I never, will. However, because I have the universe at my fingertips to guide me with whatever I'm trying to achieve, implementing a CDN is a very manageable task. To summarize the steps provided in the link, here are 3 big points in order:

    1. Prepare your content → i.e be sure to know where the content is located in the origin-server. I.e is it in a specific directory? Is it from a specific database? For each piece of content that you plan on delivering via the CDN, be sure that there is a GET-request endpoint in the origin-server that can get the piece of content on demand.

    2. Create and configure the distribution → here are the key configurations to set:

      • Origin domain → domain of the origin-server
      • Price class → either 100, 200, or 'All' depending on number of edge-locations you'd like to serve
      • Default root object → the content that should be returned when the user requests just the root-url
    3. Use the CDN → whenever you want to access a file from the CDN, make a get-request to the CDN using this technique: figure out what the path will be to access the file from the origin-server. i.e would it be /static/images/dogImg.png? If so, then this is the request to make to the CDN: https://your-cloudfront-cdn-domain-here/static/images/dogImg.png.