简体   繁体   English

Google CDN服务器托管本地托管的VS.

[英]Google CDN servers hosted libraries VS locally hosted

当我们使用已存储在某处的文件(如Google托管的库或字体)而不是存储在我们网页的本地服务器上的文件时,例如性能视角的差异,会有区别吗?

Yes, there are a few differences. 是的,有一些差异。 In most of the scenarios, your page will load much faster because: 在大多数情况下,您的页面加载速度会快得多,因为:

  • If your browser already has a cached version of the library for some other site, it won't load it again. 如果您的浏览器已经为某个其他站点提供了库的缓存版本,则不会再次加载它。
  • Your browser may connect to Google or other CDN servers simultaneously, which may not happen if you are loading from your server. 您的浏览器可能会同时连接到Google或其他CDN服务器,如果从服务器加载,可能不会发生这种情况。
  • The latency in getting the file from a Google server is almost always significantly shorter than with your server. 从Google服务器获取文件的延迟几乎总是比服务器短得多。
  • You will also have reduced load on your server. 您还将减少服务器的负载。

The scenario where you may want to host on your site is if you are serving content for countries where Google, Google's CDN or similar are blocked. 您可能希望在自己的网站上托管的方案是,如果您要为Google,Google的CDN或类似网站被阻止的国家/地区提供内容。

Yes, these is small difference exists. 是的,这些存在的差别很小。 Modern browsers has limit, for example: no more than 4 parallel downloads from one domain. 现代浏览器有限制,例如:从一个域下载不超过4个并行。 So, if you will use fonts from Google CDN servers, it possible, page will load little bit faster. 因此,如果您将使用来自Google CDN服务器的字体,那么页面加载速度会更快一些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM