balena-io / pensieve

A tool for managing and viewing structured documents, backed by the power of git
7 stars 5 forks source link

Serve pensieve js from a CDN #271

Open LucianBuzzo opened 6 years ago

LucianBuzzo commented 6 years ago

We can put the bundle pensieve JS code behind a CDN to improve load times.

lurch commented 6 years ago

Oh, S3 doesn't count as a CDN?

LucianBuzzo commented 6 years ago

@lurch S3 is a storage service and doesn't focus on content delivery, which is why AWS provide CloudFront as a CDN solution.

We should investigate publishing pensieve to npm and using https://unpkg.com for content delivery.

lurch commented 6 years ago

Aren't the load times more likely to be impacted by loading the actual YAML data from Github though, than they are by loading the minified JS? Although perhaps you've already profiled this... ;)

@lurch S3 is a storage service and doesn't focus on content delivery, which is why AWS provide CloudFront as a CDN solution.

Ahhh, thanks for the info :)

lurch commented 6 years ago

P.S. I'm not fully aware of the "minification conventions" but should https://resin-production-downloads.s3.amazonaws.com/pensieve/latest/pensieve.js actually be named pensieve.min.js ?

LucianBuzzo commented 6 years ago

@lurch Just because load times are strongly affected by Yaml retrieval from GitHub does not make serving JS from a CDN an invalid issue. If you'd like to discuss or improve load times of GitHub data, then please feel free to open a separate issue concerning this. Additionally, If you think that the file stored on S3 uses an incorrect naming convention then please open a separate issue for that as well. This issue is specifically about using a content delivery network to serve the Pensieve bundle.

lurch commented 6 years ago

Sorry for adding in off-topic conversations. I don't feel strongly enough about any of them to warrant opening new issues for them.

lurch commented 6 years ago

BTW, the only reason I mentioned the GitHub YAML loading, was that I was assuming that the JS and the YAML were being loaded in parallel (from separate servers), and also assuming that the load-times for the YAML would outweigh the load-times for the JS; and so I was wondering if serving the JS from a CDN would be "optimisation effort in the wrong place". (IYSWIM)

But now that I think about it a bit more, I realise that the JS has to be loaded first, because it's code inside the JS that actually makes the request for the YAML :wink: (I also didn't realise that the minified Pensieve JS is 1.5MB!)