This posts comes from 3 reasons why you should let Google host jQuery for you, published by Dave Ward, September 29, 2014. I read this blog post and I think it is very useful. Another blog, Advantages and Disadvantages of a Content Delivery Network (CDN), published by David Hall, November 11, 2013, gave a more abstrct conclution of the pros and cons for CDN hosting.
Dave Ward gave three reasons for host jQuery on Google: “decreased latency“, “increased parallelism“ and “better caching“
decreased latency, based on what I understand, is the distance between your server and users, comparing with the distance between CDN’s servers and users. Since CDN is able to locate user’s location, it can ask the server that is closest to user to give response. For example, CDN may tell user to find server that it’s only 1 mile from him. Your server, however, only stay in one place. This means the user on other side of earch needs to make a long request to your server here.
increased parallelism: Broswers all have limitation for how many connection can be established at the same time. When user send request to CDN instead to your server, CDN can move one connection from your server to its server, which means your server can deliver more information to user, using the connection gap created by CDN.
better caching: If you keep all files on your server, users must download all of them every time they reload page. However, since browser can automatically detect the files coming from same CDN address are identical, it will only download it once in a long time period. Then everytime browser will try to find this file in cache first, instead of re-download it.
David Hall pointed out some disadvantage about CDN also. Most CDNs do cost money for its hosting, and the user may potentially block contents from a certain CDN, which can cause probelm on your website. Also geo-location may detect wrong location, which means user may take long time dealing with request.