HACKER Q&A
📣 hknmtt

How to distribute files in CDN?


I am building a private CDN and am wondering what is a good approach to distributing the files?

So far I have decided that I want the files to be downloaded into CDN node only when requested by client and files that won't be read for a week will be deleted.

Except that I am not sure how to approach the distribution because I could overwhelm the source of files with too many request for files from the nodes. Also I am not sure if using websocket is good enough to transfer files(so I can re-use the source's api http server connection) or whether I should send data directly via length-value "protocol" or some another one. Compression is obvious. But other than that I am not sure what modern CDNs use today.

What are some standard CDN architectures for distributing the files these days?


  👤 phillipseamore Accepted Answer ✓
CDNs are just reverse proxies. Cloudflare was built around nginx (though they have now developed their own reverse proxy) and so do most CDNs. Fastly uses Varnish. A few use Apache Traffic Server. A correctly configured nginx can easily manage caches by various rules like minimum hits, maximum age etc.