http - Using 1 single private CDN vs several public CDNs
I've been cleaning up a Shopify/Liquid project using Shopify's official VSCode extention.
One of the Warnings/Suggestions that keeps coming up is
Here is the link to spec https://github.com/Shopify/theme-check/blob/main/docs/checks/remote_asset.md (https://github.com/Shopify/theme-check/blob/main/docs/checks/remote_asset.md), but it boils down to "Discourage use of third party domains for hosting assets", listing these 3 reasons.
The benefits of HTTP/2 prioritization are lost. HTTP/2 prioritization is a mechanism used by servers. If different servers are used to deliver assets, there's no way to prioritize.
A new connection dance (DNS, TCP, TLS) must be done to start downloading the resource. With HTTPS, this takes 5 round trips to achieve. The farther away the buyer is from that domain, the longer it takes.
The slow start part of the Internet's TCP congestion control strategy must happen on every connection. This means that the download "acceleration" we commonly observe must be repeated many times over.
In my case, the website is using several popular JS packages hosted on jsdeliver, bootstrapCDN for base Boostrap, and cloudflare CDN. All website specifict assets - images, custom JS, etc are hosting on Shopify's CDN.
From my perspective, pulling a common asset such as bootstrap or jQuery from a popular CDN, should benefit the user, because they might already have it cached from some other website. (The whole reason we started using CDNs years ago in the first place)
But based on the linting spec from Shopify, it sounds like my users with browsers that support HTTP2 (which is a majority of my users) may benefit more, if I copy and upload my assets into Shopify CDN.
So do the benefits of using one CDN outweigh the benefits of possibly having cached certain assets from several public CDNs?
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.