r/programming • u/speckz • Feb 27 '17
Mastering HTTP Caching
https://blog.fortrabbit.com/mastering-http-caching3
u/didnt_readit Feb 28 '17
I don't get why the author seems to be pushing the caching proxy aspect of a CDN as a main benefit when you can easily and freely get the same benefit with a few nginx config lines on your existing server...
The only benefit to a CDN that I can see would be faster global access and DDOS protection. Or if you are so huge that one nginx instance isn't powerful enough to handle all the traffic, in which case you're not in the author's intended audience anyway...
After the Cloudflare security incident, why would you open yourself to the security risk of using a third party cache if you don't need it?
4
u/Ryan_Jarv Feb 28 '17
The CloudFlare incident was pretty bad but in general unless you have you're own teams for caching and security you are probably going to be more secure with them.
The faster access thing is pretty significant, for the majority of users today the bottle neck is latency not bandwidth (https://hpbn.co/primer-on-web-performance/#latency-as-a-performance-bottleneck). Even if you don't cache anything a CDN can improve things on the TCP layer.
1
u/didnt_readit Feb 28 '17
You make a perfectly reasonable point. However, the article specifically dismisses that advantage in the first section "Why use a CDN" (bold emphasis mine):
CDNs are intended as a globally distributed network to provide (not only) website contents faster to geographic locations, which are far from the actual infrastructure, which serves the actual content. For example: Your website is hosted in Ireland, your clients mostly sit in Australia. When a client visits your website the connection will suffer from latency leaving you with a sad client. Moving the (static) data to Australia with a CDN improves the client's experience.
However, CDNs are not limited to this use-case. As per their nature, CDNs are also a plain and simple cache; a proxy cache (or edge cache) to be precise. So, even if the geographic location part is non of your concern, you still should consider using the proxy cache aspect of CDNs to improve the experience of your users.
So the whole article is basically "Even if you don't need a CDN for lower latency, you can use it as a simple proxy cache, and here's how". That's what I'm confused about. If geographic location isn't you concern (i.e. you don't need the lower latency), then why use a CDN as your proxy cache? That's why I was a bit confused as to the point of the article. It just doesn't make sense to me. If you only want a proxy cache, nginx is easier to setup and free.
1
u/Ryan_Jarv Feb 28 '17
Still plenty of reasons to use a CDN. Bandwidth is a big one, but I also wouldn't recommended to most people they maintain there own caching proxy, it can be difficult to troubleshoot and easy to screw up.
1
u/SikhGamer Feb 27 '17
Great article - thanks!
8
u/Daneel_Trevize Feb 27 '17
There's no way speckz is human (without a serious addiction issue), and so no point thanking them.
4
8
u/the_gnarts Feb 27 '17
Too soon.