CDN for JavaScript libraries
cdnjs.com
cdnjs.com
Thomas from cdnjs here, we have been on HN before.
https://news.ycombinator.com/item?id=4412044 - 671 days ago https://news.ycombinator.com/item?id=2828516 - 1057 days ago
cdnjs has been very successful since inception in early 2011, this is mainly due to Cloudflare's early and ongoing sponsorship of the project.
According to BuiltWith, we have over 187,000 websites using cdnjs in production - http://trends.builtwith.com/cdn/CDN-JS
According to w3techs, we have just recently overtook Microsoft's cdn, which puts us in around third place for market size - http://w3techs.com/technologies/comparison/cd-cdnjs,cd-micro...
jsbin, codepen and jsfiddle users generally use our tool for code snippets.
We have had no major downtime and only one brief security problem which was due to a library version which had insecure swf's.
We have 100's of developers contributing to the project, and our repository has become quite active - http://www.ohloh.net/p/cdnjs
As always our thanks goes out to the community who help us keep the libraries up to date and Cloudflare's dedication to speeding up the web. A special mention goes to Pete Cooper who has been the primary moderator and sole reason for our growth in the last 12 months - https://github.com/petecooper
I will try to answer other questions in the thread today.
Edit: With regards to peoples privacy enquiries, because Cloudflare is our official mirror it is best to consult their privacy policy. I have been working with http://taskforce.is over the last year on campaigns against mass surveillance so I do take the issue very seriously.
Edit: Also a lot of users don't use cdnjs in production, it's just very convenient when developing to be able to quickly include scripts.
Atom Plugin - https://atom.io/packages/cdnjs Sublime Plugin - https://github.com/dafrancis/Sublime-Text--cdnjs
Then again we're developers and we can put some libraries on the server as well in case the service dies so as long as we don't rely on them exclusively it's all good.
In these global dragnet surveillance ridden times it should be a no-brainer but please don't expose your visitors to third-party websites, respect their privacy, host your assets yourself.
I'm not saying they will, but really it doesn't make sense to take the risk.
I still wish there was a "hash" attribute to script tags (and others) so that browsers could cache common JS/CSS/etc assets cross-domain.
prasanth:~/ $ http get http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js [18:22:12]
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
CF-Cache-Status: HIT
CF-RAY: 13f0d5579cd70bab-HKG
Cache-Control: public, max-age=30672000
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/javascript
Date: Mon, 23 Jun 2014 12:54:17 GMT
Expires: Sat, 13 Jun 2015 12:54:17 GMT
Last-Modified: Thu, 01 May 2014 17:45:11 GMT
Server: cloudflare-nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding
Edit: found this other thread[1] where the above is not true for cloudflare customers.I'm not accusing these guys of being dishonest, but we know that the three-letter organizations do this sort of thing, both with and without the knowledge of web hosts.
It seems like these guys (and anyone else who has a similar service) shouldn't require people to trust them. Instead, they should allow CORS (it appears cdnjs does) and provide boilerplate code that verifies the script's sha256 before inserting it into the page.
It might be because their "userbase" is still smaller than Google, but for now that might be 1 interesting reason to use CloudFlare.
http://www.baldnerd.com/make-your-site-faster-cloudflares-cd...
1. How widespread the usage is. The more widespread it is, the better the chance of finding the resource in the browser cache itself, instead of having to make external request.
2. Geo distribution of resource by the CDN. The closer the nearest CDN server to the end user, the quicker the delivery.
3. Popularity of CDN domain used to serve the resource. Since a DNS request is potentially involved in fetching the resource, the domain name should be widely used to keep the DNS cachces warmed up.
I am especially skeptical towards adding DNS calls to my page. One for HTML and one-two for static resources is what I have seen works best in practice, especially with modern browsers that do not have the two parallel downloads per domain limit.
In contrast, the speed of a DNS query is relatively fixed – that initial lookup can take a long time on a cold cache (possibly seconds, particularly internationally) and nothing will transfer until it's completed, so you really need to calculate the time to last byte with that in mind. If you're talking about small, cached files, domain sharding is often a significant step back if the entire transfer can complete over an existing connection in the time it takes to perform DNS + connection for a new hostname. This is particularly interesting when you remember that modern browsers can do DNS prefetching really early so e.g. DNS for your primary domain was completed before someone even clicked on the link and multiple connections were opened as soon as they clicked.
Steve Souders looked at this last year:
http://www.stevesouders.com/blog/2013/09/05/domain-sharding-...
> A middle ground is to alter domain sharding depending on the client: 1 domain for browsers that support SPDY, 2 domains for non-SPDY modern browsers, 3-4 domains for IE 6-7. This makes domain sharding harder to deploy. It also lowers the cache hit rate on intermediate proxies.
1. interestingly, CDNJS has supported SPDY for 2 years: https://twitter.com/cdnjs/status/231227466335797249
When entering a new continent / country it would be good to know just how close the nearest Pop is (or more importantly what the latency is) for my chosen provider.