miromannino / Justified-Gallery

Javascript library to help creating high quality justified galleries of images. Used by thousands of websites as well as the photography community 500px.
http://miromannino.github.io/Justified-Gallery/
MIT License
1.68k stars 299 forks source link

When will a CDN be available? #335

Closed FlyboyArt closed 4 years ago

FlyboyArt commented 4 years ago

It would be really nice to be able to pull the JS and CSS from a CDN rather than have to include with each website. Any thoughts to do in this with CloudFlare or something similar?

jefftucker1952 commented 4 years ago

What would the advantage be? The JS and CSS, together, are about the same size as a single thumbnail image, so they're hardly a traffic-generating problem. If you want the JS and CSS to be on a CDN, why not just do that yourself?

stpnkcrk commented 4 years ago

https://unpkg.com/ https://unpkg.com/browse/justifiedGallery@3.8.1/

FlyboyArt commented 4 years ago

The advantage is that, if many sites use your package (as you state on your website...), then chances are that another application will have already asked for and downloaded your js/css so it will already be cached locally on a users computer. For example, lots of people use 500px so would probably already have your js/css in the cache before they might come to my websites.

Building a successful website means looking for all easy places to save time and DNS lookups. If my app has to do two DNS look ups (css and js) then two downloads from my CDN or static website it's time and data bandwidth wasted (even if you think the size is insignificant, I work had to keep my sites small and fast).

An example would be jquery. Imagine if all the websites that used jquery had to download the js individually instead of being able to pick up the js from the browser cache. Lot's of DNS lookups time wasted, lots of bandwidth wasted and a percentage of customers who wouldn't wait that extra 1 second to download the code.

Not everyone accesses you code from a fast, gigbit internet connection. There are still a huge number of phones running 3G and 1 second means a lot to those folks.

Mobile first design means to program for the slowest connection and everyone faster than the slowest connection just 'wins'.

You've a really nice package and making it available as a CDN to everyone would be a nice enhancement.

jefftucker1952 commented 4 years ago

Well, that's the theory, certainly. But in practice, it doesn't seem to be working out all that well. I have encountered far too many sites that stall upon loading, with a status bar message indicating that they're waiting for some piece of code or content from some CDN. So, page loading is a few milliseconds faster... except when it punks out entirely for 15 seconds.

I've also dealt with users who are struggling with a CDN that is stubbornly serving stale content, which is even worse. "Yes, I know we're on the wrong road, but we're making great time!"

If all the resources for your site are on your own server, your site has one point of failure. If the resources for your site are coming from six different places, you have now created six points of failure. This is better, according to the CDN proponents.

But if you really want to use a CDN to deliver these tiny files, the links are there, two posts above. Go for it.

FlyboyArt commented 4 years ago

Depends on the CDN one chooses. The one listed above is nothing any developer I know would be satisfied with.

CloudFlare, AWS, Fastly, Akamai, Microsoft Azure are are used by the big companies as they are have hosting data centers all over the world.

I've never had anything but stellar service from all these guys no matter where in the world I am (or my customers are). I'm not sure which CDN you have used to get 15 second lag times but I suggest you try some of the ones I list above and I think you'd see their performance is pretty stellar.

Anyway, to each his own...