喜闻百度推出 BAE CDN 公共库

百度在大力发展 BAE 的时候没有忘记搞搞公益给大家提供点福利,听说其 BAE CDN 公共库横空出世,非常高兴。顺便简单测试了一下。

CDN 公共库是指将常用的 JS 库存放在 CDN 节点,以方便广大开发者直接调用。与将 JS 库存放在服务器单机上相比,CDN 公共库更加稳定、高速。 百度公共 CDN 自然可以在国内提供稳定、可靠、高速的服务,这是毋庸置疑的。它包含全球所有最流行的开源 JavaScript 库,在国内各家宽带接入商(联通、电信、移动等)的网络上都有节点。

至于要不要换用百度的 CDN 公共库,我还有点儿疑问,比如是否支持加密链接 HTTPS 访问,国内国外访问的速度到底怎么样。所以简单测试了一下。

服务全面吗?

大家常用的公共 JavaScript 库也就那么几个,想来百度和 Google 提供的应该都挺全,我自己也就用个 jQuery,所以只要有最新版本就行了。测试结果是:都有。

但是还有一点,现在很多地方都是用加密链接(HTTPS)访问,他们是不是都能提供呢?可惜的是,测试结果是 Google 提供,而百度目前还不支持加密访问

百度公共库目前还不支持 HTTPS 加密访问

百度公共库目前还不支持 HTTPS 加密访问

速度怎么样?

虽然我非常相信百度有能力在国内提供又好又快的网络服务,不过为了看看到底好多少,我还是简单测试了一下。分别从河南郑州联通宽带、河南郑州教育网宽带和位于日本东京的 VPS 对 libs.baidu.com 和 ajax.googleapis.com 进行了 ping 测试。进行这么简单的测试是因为我认为百度和 Google 在服务器的处理能力上应该都可以完全胜任这种服务,不会因为服务器问题而造成访问缓慢,区别仅在于用户到其 CDN 节点之间的访问速度。

下面的测试结果分3个地点列出,每节里面上面是百度的,下面是 Google 的。

联通宽带:

正在 Ping libs.baidu.com [61.158.237.23] 具有 32 字节的数据:
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=2ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=5ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=91ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57
来自 61.158.237.23 的回复: 字节=32 时间=3ms TTL=57

61.158.237.23 的 Ping 统计信息:
 数据包: 已发送 = 10,已接收 = 10,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
 最短 = 2ms,最长 = 91ms,平均 = 11ms

正在 Ping ajax.googleapis.com [74.125.31.95] 具有 32 字节的数据:
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=56ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=56ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46
来自 74.125.31.95 的回复: 字节=32 时间=55ms TTL=46

74.125.31.95 的 Ping 统计信息:
 数据包: 已发送 = 10,已接收 = 10,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
 最短 = 55ms,最长 = 56ms,平均 = 55ms

教育网:

PING apps.bdimg.jomodns.com (119.75.215.119) 56(84) bytes of data.
64 bytes from 119.75.215.119: icmp_seq=1 ttl=52 time=12.8 ms
64 bytes from 119.75.215.119: icmp_seq=2 ttl=52 time=12.1 ms
64 bytes from 119.75.215.119: icmp_seq=3 ttl=52 time=12.7 ms
64 bytes from 119.75.215.119: icmp_seq=4 ttl=52 time=11.8 ms
64 bytes from 119.75.215.119: icmp_seq=5 ttl=52 time=11.6 ms
64 bytes from 119.75.215.119: icmp_seq=6 ttl=52 time=11.8 ms
64 bytes from 119.75.215.119: icmp_seq=7 ttl=52 time=12.2 ms
64 bytes from 119.75.215.119: icmp_seq=8 ttl=52 time=11.7 ms
64 bytes from 119.75.215.119: icmp_seq=9 ttl=52 time=13.2 ms
64 bytes from 119.75.215.119: icmp_seq=10 ttl=52 time=12.2 ms

--- apps.bdimg.jomodns.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9117ms
rtt min/avg/max/mdev = 11.690/12.258/13.219/0.511 ms

PING googleapis.l.google.com (74.125.31.95) 56(84) bytes of data.
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=1 ttl=40 time=318 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=2 ttl=40 time=311 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=3 ttl=40 time=317 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=4 ttl=40 time=316 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=5 ttl=40 time=322 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=6 ttl=40 time=317 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=7 ttl=40 time=315 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=8 ttl=40 time=318 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=9 ttl=40 time=314 ms
64 bytes from tb-in-f95.1e100.net (74.125.31.95): icmp_seq=10 ttl=40 time=316 ms

--- googleapis.l.google.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9327ms
rtt min/avg/max/mdev = 311.289/316.926/322.223/2.771 ms

日本 VPS:

PING apps.bdimg.jomodns.com (119.75.215.119) 56(84) bytes of data.
64 bytes from 119.75.215.119: icmp_seq=1 ttl=51 time=368 ms
64 bytes from 119.75.215.119: icmp_seq=2 ttl=51 time=373 ms
64 bytes from 119.75.215.119: icmp_seq=3 ttl=51 time=371 ms
64 bytes from 119.75.215.119: icmp_seq=4 ttl=51 time=371 ms
64 bytes from 119.75.215.119: icmp_seq=5 ttl=51 time=367 ms
64 bytes from 119.75.215.119: icmp_seq=6 ttl=51 time=371 ms
64 bytes from 119.75.215.119: icmp_seq=7 ttl=51 time=372 ms
64 bytes from 119.75.215.119: icmp_seq=8 ttl=51 time=367 ms
64 bytes from 119.75.215.119: icmp_seq=9 ttl=51 time=370 ms
64 bytes from 119.75.215.119: icmp_seq=10 ttl=51 time=369 ms

--- apps.bdimg.jomodns.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9380ms
rtt min/avg/max/mdev = 367.445/370.323/373.498/2.037 ms

PING googleapis.l.google.com (173.194.72.95) 56(84) bytes of data.
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=1 ttl=48 time=57.0 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=2 ttl=48 time=57.0 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=3 ttl=48 time=57.8 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=4 ttl=48 time=57.0 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=5 ttl=48 time=57.1 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=6 ttl=48 time=57.7 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=7 ttl=48 time=58.0 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=8 ttl=48 time=57.4 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=9 ttl=48 time=58.3 ms
64 bytes from tf-in-f95.1e100.net (173.194.72.95): icmp_seq=10 ttl=48 time=58.0 ms

--- googleapis.l.google.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9070ms
rtt min/avg/max/mdev = 57.001/57.577/58.334/0.535 ms

总结就是,测试中,在国内访问时,百度的速度完胜 Google;在国外访问时,Google 优于百度的。嗯,貌似不测也应该知道会是这么个结果。

可是百度公共库目前还不支持 HTTPS 加密访问,这是个问题,所以……看大家的需求了。

根据我的测试,决定暂时还是不换了,继续使用 Google 公共库

其它替代

嗯,今天 chonghua 提醒了一下 Sina 也有 Ajax 的 CDN,我就想起来曾经也用过微软的,效果也不错。所以可用的 CDN 其实挺多的:

  1. 支持 HTTPS 的
    1. 谷歌 Google Hosted Libraries
    2. 微软 Microsoft Ajax Content Delivery Network
  2. 不支持 HTTPS 的
    1. 百度 CDN 公共库
    2. 新浪 SinaAppEngine 公共资源

嗯?难道国内的公司都不用 SSL 加密连接的吗?©

本文发表于水景一页。永久链接:<https://cnzhx.net/blog/baidu-bae-cdn-libs/>。转载请保留此信息及相应链接。

5 条关于 “喜闻百度推出 BAE CDN 公共库” 的评论

    • 应该是不错。不过刚才试了下,sina 的也不支持加密连接。
      P.S. 第一次见新浪的公共库,记个地址:http://sae.sina.com.cn/?m=devcenter&catId=147

  1. 淘宝搜索 百度CDN专业版代金券_百度CDN _CDN云加速_专业版_代金券 我是雷锋

时间过去太久,评论已关闭。
如果您有话要说,请到讨论区留言并给出此文章链接。
谢谢您的理解 :-)