7 ms·
If the cache is per domain, does that mean CDN-served dependencies like JQuery and React are in fact... useless in terms of cache reuse.
by slver 5y ago
If the cache is per domain, does that mean CDN-served dependencies like JQuery and React are in fact... useless in terms of cache reuse.
- floo 5y agoYes.
- WayToDoor 5y agoYes. CDNs only offer limited benefits such as lower latency and higher bandwidth.
- SemiNormal 5y agoSo still useful for images and other large files. Not so much with scripts.
- jefftk 5y agoYes. They didn't used to be, but they are now.
- move-on-by 5y agoAs others have already said: Yes, it is useless in terms of cache. Besides it being useless in terms of cache, it also incurs other overhead. Another DNS request, another TCP handshake, another TLS connection. With HTTP 1.1, this might still make sense because you don't get resource pipelining, but with HTTPv2, the extra overhead is simply extra overhead. With HTTPv3, it becomes even less useful to have the domains sharded. Generally speaking, the best use of resource usage with the modern web is to serve everything from the same domain.
- anticristi 5y agoI kind of like how protocol improvements have made the domain an authority, almost like a frontend security boundary.
- eli 5y agoHonestly cache reuse was never as high as anyone hoped. There were so many versions of jQuery and so many different CDNs that very few first time visitors already had the one you wanted.
- Cthulhu_ 5y agoAnd that's fine; CDN benefits are minimal, given how many versions of dependencies are out in the wild, and how the total payload of a website can be reduced by clever packaging and modern data transfer mechanisms. The JS standard library also improved since then, with things like CSS selectors, the Fetch API, and CSS animations being part of the standard library nowadays. I'd argue there's few 'shared' dependencies on websites nowadays.
- r1ch 5y agoUsing a library-provided CDN can be performance-negative now, since you usually need several RTTs for DNS, TCP, TLS before you even get to HTTP. Serving it from your own domain / CDN allows it to be part of an existing HTTP connection.
- kevingadd 5y agoYeah, the security changes here made CDNs go from good to actively bad.
- pornel 5y agoYes. Browsers and protocols have changed, and a lot of past performance best-practices have become actively harmful for performance. A couple of related techniques are also useless: domain sharding and cookieless domains. HTTP/2 multiplexing and header compression made them obsolete, and now they're just an overhead for DNS+TLS, and often break HTTP/2 prioritization. You should be careful with prefetch too. Thanks to preload scanners and HTTP/2 prioritization there are few situations where it is really beneficial. But there are many ways to screw it up and cause unnecessary or double downloads.
- bmn__ 5y agoTo make cacheing efficient again: https://developer.mozilla.org/docs/Web/Security/Subresource_Integrity https://developer.mozilla.org/docs/Web/Security/Subresource_... https://localcdn.org/ https://localcdn.org/