Hi Jason & company,I have noticed that upon reading the various threads, that you all are looking at putting PIE on a CDN. My question is: why? I understand about content availability, etc, etc., but, why would I want to reference PIE on a CDN instead of hosting it on my own server? Making another 'network' call has got to be more expensive (time wise) than fetching from my own server. I can't imagine the reason would be to always have the latest version since that would mean possibly running an untested version in a live environment. I must be missing something. I can't see the benefits of not hosting PIE locally. Could you or someone enlighten me?

Keep up the excellent work...Dick

Sat Mar 02, 2013 3:45 pm

jason

Joined: Wed Jul 14, 2010 11:46 amPosts: 1451

Re: Why a CDN?

First of all: using a CDN-hosted version of the JS files is completely optional and up to the individual -- by default it loads from the main domain.

Now... using a CDN can have several benefits, including:- They can serve the content from the server closest geographically to each site visitor- Avoids using up one of the concurrent connections that IE allows to your main domain, so other resources can download from your server in parallel- CDNs generally have proper Gzipping enabled, which many users might not have the knowledge or ability to configure on their own server

These are all really standard reasons for using CDNs, nothing specific to PIE. And of course the usual tradeoffs apply too -- like you mentioned the possibly extra DNS lookup, plus the dependency on a third party's service. But I think it's still a valuable option to provide, especially since it sort of comes "for free" as a nice bonus from the new loading system.

Sat Mar 02, 2013 9:58 pm

10010110

Joined: Wed Mar 13, 2013 5:18 amPosts: 2

Re: Why a CDN?

I must say I’ve grown tired of the annoying trend to increasinly outsource even simplest scripts to CDNs. This requires connection to third party servers to execute these scripts which some people – like me – have deliberately disabled. And more and more sites become completely unusable because some lazy developer or ignorant n00b just puts a link to an external CDN in their websites without even thinking of a local fallback solution (despite the fact that they write crappy code so that the working of their website relies on JavaScript). I’ve seen someone in a comment to the 2.0 announcement asking about a CDN and this alone shows how lazy and ignorant people have become. They don’t even want to think about how to implement a script, they just wanna put a link to somewhere. In my opinion those people don’t deserve to use it if they don’t care about anything.

I see no advantage whatsoever to serve CSS3PIE from a CDN. I can understand that for large applications like video streaming servers or whatever but not for a comparably small script like CSS3PIE.Sorry for the rant but I had to get that out of my system.

Wed Mar 13, 2013 5:44 am

jason

Joined: Wed Jul 14, 2010 11:46 amPosts: 1451

Re: Why a CDN?

While I agree with you that blindly using CDNs without properly considering the tradeoffs is naive (this is why PIE does not use a CDN by default), I also think that the "CDNs have no benefit, never use them" attitude is similarly naive. As I mentioned above, there are some real benefits to using CDNs, as well as some real downsides, and calling those who make that choice responsibly "ignorant" or "lazy" is unfair.

You bring up some good points, so let's discuss these:

- You say you disable scripts from other domains. I'm unfamiliar, is this an option in IE? How do you set it? Is there a way to detect in code when a user has that setting enabled, so that PIE can automatically fall back to local loading? I'll gladly implement that if possible.

- I sympathize with your concern about reliance on third-party servers. That becomes a real problem if the scripts are loaded synchronously, or if the site can't function without the scripts. With PIE, however, neither of these is an issue in my opinion -- if it's configured to load from an external domain it will do so asynchronously so the page is not blocked from rendering, and PIE only provides visual effects which shouldn't ever prevent site functionality anyway.

Also, let's not fall into the trap of assuming that "separate domain" equals "third-party server". It's quite possible (and I think somewhat common) to use several domains that resolve to the same physical server or cluster, to enable the technique known as "domain sharding" to get around concurrent connection limits imposed by browsers -- I've done this in the past and it can improve site performance significantly, especially in old IE where the connection limit is low.

All good discussion. If anyone wants to take a whack at drafting some guidelines on the pros/cons of loading from external domains, I think that would be a valuable resource for PIE users and I'd gladly include it in our docs.

Wed Mar 13, 2013 11:25 am

10010110

Joined: Wed Mar 13, 2013 5:18 amPosts: 2

Re: Why a CDN?

jason wrote:

While I agree with you that blindly using CDNs without properly considering the tradeoffs is naive (this is why PIE does not use a CDN by default), I also think that the "CDNs have no benefit, never use them" attitude is similarly naive. As I mentioned above, there are some real benefits to using CDNs, as well as some real downsides, and calling those who make that choice responsibly "ignorant" or "lazy" is unfair.

I’m not saying that CDNs have no benefit and I’m not saying I never use them. Those who make the choice responsibly deserve all my respect. However, according to my experience this is a real minority and I see too many people with that lazy attitude around these days. With developments like Modernizr, HTML 5 boilerplate, jQuery, SASS/LESS etc. and everything served from CDNs with just a copy/paste it has become just too easy to negligently throw something together without much thinking, and that actually puts even more load on the user’s bandwidth and/or browser. It’s just so sad to see something useful being misused just because it can be done.

jason wrote:

- You say you disable scripts from other domains. I'm unfamiliar, is this an option in IE? How do you set it?

To be honest, I’m using Firefox with the NoScript add-on. But I seem to remember a setting in Safari where you can disable third party scripts (or was it just for cookies?). But anyway, there are script blocking extensions for every major browser out there nowadays, and these have received an increasing popularity for exactly that reason: because it has become annoying how many scripts are being loaded and make sites slow and bloated, track you down, and annoy you with ads. And if someone is using Cloudfront to serve their useful scripts that doesn’t mean someone else wouldn’t use it to serve suspicious or unnecessary scripts. So you have the choice to either block Cloudfront altogether and risk some legitimate but badly coded sites to not work anymore or to accept suspicious scripts from other websites.

jason wrote:

Is there a way to detect in code when a user has that setting enabled, so that PIE can automatically fall back to local loading? I'll gladly implement that if possible.

I’ve worked with jQuery in the past where I checked for the presence of the jQuery object/function and if not present would load a local fallback copy. The code looks something like this:

Where runScript() is the function that holds all my custom JS. That code above would be included after the script reference to the CDN.

jason wrote:

- I sympathize with your concern about reliance on third-party servers. That becomes a real problem if the scripts are loaded synchronously, or if the site can't function without the scripts. […]

Also, let's not fall into the trap of assuming that "separate domain" equals "third-party server". It's quite possible (and I think somewhat common) to use several domains that resolve to the same physical server or cluster, to enable the technique known as "domain sharding" to get around concurrent connection limits imposed by browsers -- I've done this in the past and it can improve site performance significantly, especially in old IE where the connection limit is low.

In those projects where I was involved I have never had a noticeable performance hit with loading scripts synchronously (I even reference my scripts in the document head out of personal preference) but maybe that’s because I’m not randomly adding hundreds of third party widgets and what not. And I even think this speed argument is kind of construed by nerds that feel joy by analyzing scripts all day and care about microseconds of loading time.And you are right, CSS3PIE is not that crucial for the functioning of a website. I just wanted to express my concern that, if one makes it seem too simple to use something, the likelihood of it being used improperly is much bigger, which is the case with the increasing move towards CDNs for every minor script someone provides.

Wed Mar 13, 2013 6:41 pm

jason

Joined: Wed Jul 14, 2010 11:46 amPosts: 1451

Re: Why a CDN?

Quote:

But anyway, there are script blocking extensions for every major browser out there nowadays...I’ve worked with jQuery in the past where I checked for the presence of the jQuery object/function and if not present would load a local fallback copy. The code looks something like this:

In those projects where I was involved I have never had a noticeable performance hit with loading scripts synchronously

I was referring to synchronously loading scripts from third-party CDNs. The issue is that if the third-party CDN goes down, and you load a script from it in a script tag in the head of your markup, then your page will block loading and won't continue until the CDN request times out. Sync loading of scripts from a domain you control isn't as much of an issue. And as I said, since PIE loads async, it won't block your page even if the CDN goes down.

Quote:

And I even think this speed argument is kind of construed by nerds that feel joy by analyzing scripts all day and care about microseconds of loading time.

That made me laugh. I'd never say I got "joy" out of that sort of analysis, but I can tell you that I've seen real loading time improvements in *seconds* using sharding for users on slow connections. Don't dismiss it so readily.

Quote:

And you are right, CSS3PIE is not that crucial for the functioning of a website. I just wanted to express my concern that, if one makes it seem too simple to use something, the likelihood of it being used improperly is much bigger, which is the case with the increasing move towards CDNs for every minor script someone provides.

I think that's a risk I'm willing to take. If you're concerned about abuse, I'd welcome your help in drafting a guide to help users make the decision responsibly.

Thu Mar 14, 2013 8:30 am

lucideer

Joined: Fri Mar 15, 2013 4:02 amPosts: 1

Re: Why a CDN?

Very refreshing to see people actually discussing CDNs rationally rather than blindly using them without any real consideration of their apparent benefit.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum