Live data from Hacker News

Unpkg CDN down causing dependent website outages

github.com

21–30 of 39 posts

Re: Unpkg CDN down causing dependent website outages

#21
post #17

Unless you're running a site that you know is constantly getting hits from all over the globe, using a CDN will make your site load slower for some users. And you almost certainly don't need one for scaling purposes. I've handled frontpage traffic multiple times without. What I wish existed (or maybe does) is something like a CDN with ~8 global locations that promises to keep your static site in a warm cache for a sm…

You're looking for a CDN with an integrated storage service, bunny.net has that feature[1]. They also have a volume tier for cheaply serving files[2] which seems to meet your need for a low PoP count (with some discounts to go along with it).

[1] https://support.bunny.net/hc/en-us/articles/360017093479-Und...

[2] https://bunny.net/network/

Re: Unpkg CDN down causing dependent website outages

#22
post #6

Earlier quoted context omitted.

I invite everyone (even those not affected in this instance) to consider switching away from relying on random third parties for your hosting. Like wtf how is did this ever become the norm even when there was a slight performance advantage from a shared cache, which doesn't even exist anymore these days.

I do both. If you are loading a JS lib then check for its existence on the client. If it's not found load the resource from your server. You could also achieve this on the server side.

1. You realise caches, even for third party assets are partitioned by host domain in most modern browsers now? So you're not getting a benefit that users loaded the script from someone else's site.

2. For saving bandwidth on the server are you using proper cache setup with etags and If-Modified-Since support? It shouldn't have to download a first party asset again if it's in the cache. It's worth pointing out that non-ancient versions of all major web servers do this by default.

3. Haven't you now added latency by first making users download the loader script, have that execute, and then start loading the dependencies?

Re: Unpkg CDN down causing dependent website outages

#23
post #14

This is one thing I never understood about web development. I would have thought the risks from 3rd party production dependencies would make devs do all in their power to minimize them. But IIUC it's a somewhat common practice. Is there something about the market dynamics that make this a reasonable tradeoff? E.g., the problems are rare and this somehow allows faster time to market? (Asking as a systems programmer, v…

> But IIUC it's a somewhat common practice. I don’t have any data but I really don’t think it actually is that common. I definitely heard it used a lot more in the 2000s jQuery era but not really today. Browsers even have isolated storage these days so the benefits really are infinitesimal.

I think it's fairly common. I was reviewing an implementation of a phone number input component last month. It looked great, changing the country code automatically showed the correct country's flag or vice versa select your flag and the country code updated, plus a bunch of useful phone number validation logic was provided, you just add the NPM package and use the resulting component and magic happened. But open up dev tools and you see that all the flags are being brought in from a CDN. The only fix is to fork the library and change asset paths in their code to self host. Many libraries are like this, icon collections, design system web components, whatever. If you're not vigilant it's easy to lazily include CDN hosted assets without explicit intent.

Re: Unpkg CDN down causing dependent website outages

#24
post #17

Unless you're running a site that you know is constantly getting hits from all over the globe, using a CDN will make your site load slower for some users. And you almost certainly don't need one for scaling purposes. I've handled frontpage traffic multiple times without. What I wish existed (or maybe does) is something like a CDN with ~8 global locations that promises to keep your static site in a warm cache for a sm…

> What I wish existed (or maybe does) is something like a CDN with ~8 global locations that promised to keep your static site in a warm cache for a small fee

IIRC this is what Cloudflare Argo is supposed to do? https://www.cloudflare.com/en-gb/application-services/produc...

Rather than routing cache misses to origin, it'll route to other PoPs with the cached content?

Re: Unpkg CDN down causing dependent website outages

#25
post #17

Unless you're running a site that you know is constantly getting hits from all over the globe, using a CDN will make your site load slower for some users. And you almost certainly don't need one for scaling purposes. I've handled frontpage traffic multiple times without. What I wish existed (or maybe does) is something like a CDN with ~8 global locations that promises to keep your static site in a warm cache for a sm…

> What I wish existed (or maybe does) is something like a CDN with ~8 global locations that promised to keep your static site in a warm cache for a small fee

cloudflare cache reserve or bunny.net as someone else mentioned

Re: Unpkg CDN down causing dependent website outages

#26
post #3

I invite everyone affected to consider switching to a production focused CDN https://www.jsdelivr.com/ There is also a tool to simplify migration https://www.jsdelivr.com/unpkg

Why? If you care about being even remotely reliable (hinted at with "production-focused"), why would you do this? Just use the same host as where you serve everything else from.

Browsers have partitioned caches per origin for over 10 years, so there's no performance gains from getting cache hits from other websites.

Re: Unpkg CDN down causing dependent website outages

#27
post #14

Earlier quoted context omitted.

> But IIUC it's a somewhat common practice. I don’t have any data but I really don’t think it actually is that common. I definitely heard it used a lot more in the 2000s jQuery era but not really today. Browsers even have isolated storage these days so the benefits really are infinitesimal.

I think it's fairly common. I was reviewing an implementation of a phone number input component last month. It looked great, changing the country code automatically showed the correct country's flag or vice versa select your flag and the country code updated, plus a bunch of useful phone number validation logic was provided, you just add the NPM package and use the resulting component and magic happened. But open up…

This is wild. I don't think this is very common.

Re: Unpkg CDN down causing dependent website outages

#28
post #7

its a fascinating little tech-anthropology quirk that front-end/web developers use the term "CDN" to mean a different thing from how devops/sre/infra people use the term. in the strictest sense, unpkg is not a cdn. unpkg is a javascript library hosting service that uses cloudflare as a cdn. cloudflare is not down, therefore this headline "unpkg cdn down..." reads as a massive "oh shit!" to infra/devops type cloudflar…

> its a fascinating little tech-anthropology quirk that front-end/web developers use the term "CDN" to mean a different thing from how devops/sre/infra people use the term.

Do they? Same to me.

> in the strictest sense, unpkg is not a cdn. unpkg is a javascript library hosting service that uses cloudflare as a cdn.

This is just arguing over semantics. It even says on the website that unpkg CDN is powered by Cloudflare.

By your analogy if a website hosted on AWS is down, is the whole of AWS down? If I provide managed kubernetes on GCP and my service is down, does that make GKE or GCP down? No.

A CDN is a CDN just like a website is a website, whether it's backed by Wordpress, NextJs or any other thing.

Re: Unpkg CDN down causing dependent website outages

#29

This is one thing I never understood about web development. I would have thought the risks from 3rd party production dependencies would make devs do all in their power to minimize them. But IIUC it's a somewhat common practice. Is there something about the market dynamics that make this a reasonable tradeoff? E.g., the problems are rare and this somehow allows faster time to market? (Asking as a systems programmer, v…

> I would have thought the risks from 3rd party production dependencies would make devs do all in their power to minimize them.

Tell that to any developer (not just web) that outsources everything these days e.g. authentication, storage, analytics, database, etc - you name it.

They think it's less risk (and this includes managers and directors in larger companies). Apparently in-house would take forever, cost more and be unable to maintain anything these days.

I don't get it either but it's the current train of thought / trend and is not tied to individual developers.

Post reply on HN