包含脚本,使用CDN(Google)或将它们本地存储在网站根目录中的速度更快? [英] What's faster for including scripts, using CDN (Google) or storing them locally in website's root?

查看:131
本文介绍了包含脚本,使用CDN(Google)或将它们本地存储在网站根目录中的速度更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

包含脚本,使用CDN(Google)或将它们本地存储在网站根目录中的速度更快? 如果你的意思是核心jQuery库,使用谷歌CDN 作为面向互联网的网站(相反到内部)。



CDN具有以下难以与之竞争的优势:


  • 更多服务器

  • 带宽(您不支付费用)

  • 地理位置(较低的响应时间)
  • 冗余

  • 优化的缓存设置

  • 用户已有的机会缓存文件
  • >
  • 并行下载,用户可以同时从您的网站获取其他内容



尽管您可以像配置缓存标头一样配置缓存标头,但您可能无法更快地提供文件。话虽如此,图书馆/ CDN只是难题的一部分。您拥有的杂项插件和代码也应该缩小,合并通过gzip提供


What's faster for including scripts, using CDN (Google) or storing them locally in website's root?

解决方案

If you mean the core jQuery libraries, use the google CDN for an internet-facing site (as opposed to an internal one).

The CDN has the following advantages you'll find hard to compete with:

  • More servers
  • The bandwidth (you don't pay for)
  • Geolocation (lower response time)
  • Redundancy
  • The optimized caching settings
  • Chance the user has already cached the file from there
  • Parallelized downloads, user can grab other content from your site at the same time

Though you can configure the cache headers just like they do, you probably can't serve the file faster. That being said, the library/CDN is only part of the puzzle. Miscellaneous plugins and code you have should also be minified, combined and served via gzip.

这篇关于包含脚本,使用CDN(Google)或将它们本地存储在网站根目录中的速度更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆