Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
412 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...