缩小和Gzip与Google CDN [英] Minify & Gzip vs Google CDN
问题描述
我应该使用页面上的其他脚本来缩小/gzip Jquery,还是使用Google CDN for Jquery& jQuery UI和gzip我自己的东西.
Should I minify/gzip my Jquery with my other scripts on my page, or use Google CDN for Jquery & JQuery UI and gzip my own stuff.
据我所知,它更有可能更快地从Google交付,并且更有可能将文件缓存在用户计算机上,但是它有几个额外的http请求,至少我知道它会总是可用.
From what I can see its more likely to be faster to deliver from Google and there is a better chance the files will be cached already on the users machine, however its a couple of extra http request and at least I know it will always be available.
推荐答案
您说对了. 对于广泛使用的库,使用Google CDN是一个好主意:
You got it right. For widely-used librairies, using Google CDN is a good idea:
- 在服务器上使用更少的带宽
- 资源可用性很好
- 服务器位置也很好(毕竟这是CDN!)
- 就像你说的那样,这些资源更有可能已经在用户端被缓存了
唯一的缺点:
- 添加DNS查询,因为您将资源托管在其他域上. 减少DNS查找非常重要.
所以答案是使用Google CDN".
So the anwser is "use Google CDN".
这篇关于缩小和Gzip与Google CDN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!