Microsoft CDN for jQuery or Google CDN? [closed]

2019-01-03 11:59发布

Does it actually matter which CDN you use to link to your jquery file or any javascript file for that matter. Is one potentially faster than the other? What other factors could play a role in which cdn you decide to use? I know that Microsoft, Yahoo, and Google all have CDN's now.

18条回答
来,给爷笑一个
2楼-- · 2019-01-03 12:18

It probably doesn't matter, but you could validate this with some A/B testing. Send half of your traffic to one CDN, and half to the other, and set up some profiling to measure the response. I would think it more important to be able to switch easily in case one or the other had some serious unavailability issues.

查看更多
Ridiculous、
3楼-- · 2019-01-03 12:23

In the summery it says that microsoft is not offering UI, that is not correct (any more). It can be downloadloade at http://www.asp.net/ajaxlibrary/cdn.ashx.

查看更多
别忘想泡老子
4楼-- · 2019-01-03 12:24

Is one potentially faster than the other?

I was actually curious of this myself so I setup a jsbin test page using each of the following and then ran it through webpagetest.org's visual comparison tool. I tested:

  1. ajax.googleapis.com
  2. code.jquery.com
  3. ajax.aspnetcdn.com
  4. cdnjs.cloudflare.com

Who was fastest: code.jquery.com by 0.1 second in both tests

Who was slowest: ajax.aspnetcdn.com by 0.7 seconds in first test and ajax.googleapis.com by 1 second in second test

Here's the 1st test (each was tested 3 times):

Video: http://www.webpagetest.org/video/view.php?id=121019_16c5e25eff2937f63cc1714ed1eac814794e62b3

Reports: http://www.webpagetest.org/video/compare.php?tests=121019_D2_KF0,121019_9Q_KF1,121019_WW_KF2,121019_9K_KF3

Here's the 2nd test (another 3 each):

Video: http://www.webpagetest.org/video/view.php?id=121019_a7b351f706cad2c25664fee7ef349371f17c4e74

Reports: http://www.webpagetest.org/video/compare.php?tests=121019_MP_KJN,121019_S6_KJP,121019_V9_KJQ,121019_VY_KJR

查看更多
淡お忘
5楼-- · 2019-01-03 12:24

Google will send you a jQuery version minified with their own software, this version is 6kb lighter than the standard minified version served by MS. Go for Google.

查看更多
Ridiculous、
6楼-- · 2019-01-03 12:25

One additional consideration - if your site is SSL and you need to support Android 2.1 (or earlier), the SSL certificate on the HTTPS version of the Microsoft CDN will crash those versions of the Android browser, per this issue: http://code.google.com/p/android/issues/detail?id=5001. It's not Microsoft's "fault", as the SSL certificate is technically valid and the defect is in Android's SSL implementation... but it will crash your site, nonetheless.

The SSL cert on Google's CDN does not fall afoul of this particular issue (relating to the certificate's "Certificate Subject Alt Name").

So, for SSL + Android 2.1 support, use the Google CDN.

查看更多
虎瘦雄心在
7楼-- · 2019-01-03 12:30

One minor thing to consider is that both companies offer slightly different "extra" libraries:

Depending on your needs, this may be relevant.

查看更多
登录 后发表回答