Opinions on CDN

12 views
Skip to first unread message

Markus Pope

unread,
May 10, 2013, 4:10:13 PM5/10/13
to sgfd...@googlegroups.com

Do you fellers have any opinions on CDN-hosted javascript?  Good?  Bad?  Any personal experience?

 

Thanks,

Markus

b...@benandsuz.com

unread,
May 10, 2013, 4:21:23 PM5/10/13
to sgfd...@googlegroups.com
I think it’s a good idea overall for performance reasons, but I recommend providing a fallback for the script like the following:
 
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
 
CDNs have been known to have outages.  I’ve also ran into a problem once where a user on a corporate network had some IE-related issue that didn’t allow the external script.
 
I’ve only used CDNs for 3rd party libraries that are versioned.  If you are hosting your own libraries, you could run into some caching issues unless you use a good versioning strategy or some other strategy.
 
Hope that helps!
Ben
 
 
Sent from Windows Mail
 
--
--
Springfield .NET Users Group - http://www.sgfdotnet.org
To post to this group, send email to sgfd...@googlegroups.com
To unsubscribe from this group, send email to sgfdotnet-...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sgfdotnet?hl=en
---
You received this message because you are subscribed to the Google Groups "Springfield .NET Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sgfdotnet+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

J.P. Cummins

unread,
May 10, 2013, 4:28:18 PM5/10/13
to sgfd...@googlegroups.com
It's great for libraries that are stable and never change (jQuery, et. al). However, if your code changes often or you're using HTTPS, it can be problematic. You have to have to have a good versioning system so the JS stays in sync with the CDN when you deploy a build. 

Unless your serving millions of requests a day, I'd avoid it. Instead look at other ways to optimize your JS.


--
J.P.


--

Markus Pope

unread,
May 10, 2013, 4:37:07 PM5/10/13
to sgfd...@googlegroups.com

Good feedback Ben and JP, thanks!

 

Markus

Jeff Berry

unread,
May 10, 2013, 4:37:47 PM5/10/13
to sgfd...@googlegroups.com
I assume you have a lot of javascript or you wouldn't be asking.
 
We have used the Telerik CDN which is hosted on Amazon with great success.  It obviously contains more than just javascript, but the potential benefits should be the same. 
 
I believe browsers will open only a limited # of connections at a time to a given domain.  So, separating javascript files to a CDN can be quite beneficial as the browser can pull the scripts AND your content simultaneously.  It obviously also unburdens your web server(s).  Same thing with image files, having them pull from a different domain can help performance.
 
The only downside we've experienced that it is possible that users may be able to get to your site but not to the CDN (due to firewall, DNS probs or whatever).  The solution is to use some type of beacon on your CDN and if it's missing, default to pulling the javascript from your server. 
 
If it's your content/javascript, then you obviously have to worry about versioning as your site evolves.  We don't have that concern w/Telerik since they handle that.
 
And as a general disclaimer: anything like this is relative to your specific situation (environment, size of files, amount of traffic, etc...). 
 
That's my .02
:)
 
--
--
Springfield .NET Users Group - http://www.sgfdotnet.org/

Chad Boschert

unread,
May 10, 2013, 4:48:06 PM5/10/13
to sgfd...@googlegroups.com
Markus, if you're not already, I'd recommend using a tool like Google's PageSpeed (or Yahoo's YSlow) to identify and prioritize what you need to optimize. There may be other areas that could offer better performance improvements for your effort.

Ray

unread,
May 10, 2013, 6:29:22 PM5/10/13
to sgfd...@googlegroups.com
Unrelated to this specific issue, but quite relevant is to bundle and minify scripts to greatly increase performance.:

http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

justin coon

unread,
May 10, 2013, 6:42:22 PM5/10/13
to sgfd...@googlegroups.com, smda...@gmail.com

Was just going to recommend checking out bundling and minification...

Sent from Yahoo! Mail on Android



From: Ray <smda...@gmail.com>;
To: <sgfd...@googlegroups.com>;
Subject: Re: Opinions on CDN
Sent: Fri, May 10, 2013 10:29:22 PM

Markus Pope

unread,
May 11, 2013, 2:36:38 PM5/11/13
to sgfd...@googlegroups.com

Thanks everyone for your feedback!  Most helpful!

 

From: sgfd...@googlegroups.com [mailto:sgfd...@googlegroups.com] On Behalf Of Ray
Sent: Friday, May 10, 2013 5:29 PM
To: sgfd...@googlegroups.com
Subject: Re: Opinions on CDN

 

Unrelated to this specific issue, but quite relevant is to bundle and minify scripts to greatly increase performance.:

 

http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

Reply all
Reply to author
Forward
0 new messages