I generally bundle everything I need in with my site - I don't like relying on other services being online to make my site work (within reason!) :-)
Should I move to a CDN?
Just finishing up a project, I was using a CDN (Bootstrap and JQuery) in development and was going to download them to my assets, on my live server.
Is this the best thing to do?
http://fallback.io/
Fallback JS is a tiny library that allows you to load both JavaScript and CSS libraries after your page has already loaded. Our library also allows you to specify "failovers" or "fallbacks" for each of your libraries, that way in case one of those external libraries your site is using happens to go down, you won't be leaving your users with a dysfunctional website. Just because someone else's website breaks, it doesn't mean that yours should!
Not sure if it makes any difference but the application is only used internally and is hosted on AWS.
@phpMick the benefit of CDN is that if a user visits SiteA and they use jQuery CDN, and then same user visits SiteB and they also use jQuery CDN he won't have to re-download jQuery.. If you feel you benefit from this, use CDN, otherwise keep the files local.
The reason that @SaeedPrez points is why CDN is actually the best approach, because cache is your best friend when you need to load a page as quick as possible
Left them in the CDN for now.
CDN with a local fallback is also an option though... but CDN's are more reliable than your own server tbh...
... but CDN's are more reliable than your own server tbh...
If we just look at the reliability aspect of it, what does it matter if your server/website is down and your jQuery CDN is up?
Of course, it's a different story if you use CDN for your website too but that was not what OP asked.
It's AWS so I'm hoping it shouldn't be down.
It really depends on what you are wanting. The reason to use a CDN is for better performance (caching on POPS) and reliability. A better approach might be to still use a CDN, but copy the assets to one single CDN provider. Bootstrap and jQuery are hosted on fast CDNs, but if you want to reduce DNS lookups, get a single connection, etc, and the best performance, try moving them to one... See a comparison of some CDN providers here: http://cdncomparison.com/
Second @bjuser 's comment. It depends on what you want.
I use https://www.cloudflare.com as a CDN because Laravel Elixir makes it so easy to version my assets and reduce the number of HTTP calls the users must make to view a page. This increases the speed of my applications and (arguably) gives an SEO advantage in faster load times for all links in the site.
Be careful if you attempt this without 'cache busting' (versioning) implemented. I've had several past experiences with having browsers cache old copies of my JavaScript and the problems can be VERY difficult to track down in that case; however, with versioning, it's a non-issue.
I generally host core scripts and styles on my site, for anything requiring user content, such as images, will these days use a CDN.
It also depends on where your site visitors are located. If your visitors are spread all around then globe then using a CDN will be quite beneficial in terms of performance as a visitor's request will only need to go to the nearest CDN edge server instead of your origin server.
Additionally, even if your visitors aren't spread across the globe but your origin server is far away, then choosing a CDN with POP locations near your visitor region will also be beneficial.
Be sure to check a CDN's network page to find out exactly where their POPs are located. To get a good overview of various CDN providers and to know where each provider's POPs are located, I'd recommend checking out: https://cdn.reviews/
Please or to participate in this conversation.