Skip to content

Instantly share code, notes, and snippets.

@wu-wuxl
Last active April 24, 2018 04:43
CDN

What 's CDN?

https://www.webopedia.com/TERM/C/CDN.html

What's compoenents?

A Content Delivery Network (CDN) consists of two components: The Origin Server(s) – where the content to be distributed over Internet is originally stored & Cache Server(s) – where the content is duplicated. There is generally one Origin Server

How does CDN work?

Using CDN

What Type of Content Is Stored on a CDN?

Here is an example of just some of the file types that can be hosted on a CDN:

  • Images: PNG, JPG, SVG, GIF, TIF
  • Stylesheets: CSS
  • Javascript: JS
  • Video and Audio: FLV (Flash), HLS, MP4 (HTML5 videos), MOV (QuickTime), WMV (Windows Media), MP3 and WAV
  • Web Fonts: EOT, TTF, OTF, CFF, AFM, LWFN, FFIL, FON, PFM, PFB, WOFF, SVG, STD, PRO, XSF, and more…
  • Other File Formats: HTML, JSON, PDF, DOC, PPT, XLS, EPUB, ODT, ODP, ODS, TXT, RTF, ZIP

Cache Strategy

Bélády's Algorithm

Always discards the information that will not be needed for the longest time in the future. This too-good-to-be-true approach is only possible when one can predict how far in the future information will be needed. As a result, this algorithm is rarely used in practice.

Least Recently Used (LRU)

Discards the least recently used items first. This algorithm is implemented by assigning an age counter to each cached resources and discarding those with low counters. Generally this is the most effective method of cache management.

Most Recently Used (MRU)

As opposed to LRU, this discards the most recently used items first. This algorithm is most useful in situations where the older an item is, the more it is likely to be accessed.

Example

https://www.bootstrapcdn.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment