Hacker News new | past | comments | ask | show | jobs | submit login

I'm confused. In most cases, the libraries will arrive faster from the CDN than each user's web server. CDNjs' reason for existence is specifically that these libraries are not available in other CDNs. HTTPS must be supported on HTTPS pages to avoid security warnings. Why would you use this to pass around how-to HTML files?



It might arrive faster on a CDN but the time that it takes the user's computer to connect to a DNS server to resolve the CDN may override the benefits if the user has a slow DNS which is a fairly common problem now days. If the server used a single CDN instead of all these misc CDNs then you only have one DNS lookup and it would be worth it then. But a CDN dedicated to a single file type kind of defeats the purpose unless your website doesn't have any images, css or anything.


I wasn't aware that a single DNS lookup was that expensive. Aren't they frequently cached? And with more people using cdnjs, there's a better chance the DNS entry as well as the assets might already be cached, leading to an even greater performance gain.

When you say "all these misc CDNs" you're talking about just one, CDNjs, right?

I suppose the CDN could host other assets if it made sense. But I can't think of any other assets with the type of commonality that JavaScript libs have.


"... the user has a slow DNS which is a fairly common problem now days"

I would find this somewhat surprising given the increased use of hosted DNS providers for both authoritative and recursive. Can you point to any data that corroborates this (not saying it isn't true, just looking for hard data)?


The real benefit of using one repository across multiple sites is that it increases the likelihood the library is available from the browser's cache. DNS lookup and retrieval will need to happen the first time a visitor goes to a site with a CDNJS library. If that same visitor visits another site that uses the same library then the library can be fetched from the browser's cache without any DNS or download latency. In other words, the more sites that use CDNJS, the bigger the benefit to the whole CDNJS community.


Could one solve this problem with URLs of this form?

http://199.27.135.101/ajax/libs/prototype/1.7.0.0/prototype....

CloudFlare doesn't seem to support direct access based on IP, but there's no reason it couldn't, right? Do browsers support this?


I don't think it's possible. CDN by its very nature is to send content in low latency manner to users in different geographical locations by having multiple servers also spread in different geographical locations. Users from different parts of the world might get identical CloudFlare URLs resolved to different IP addresses based on where they live, to make sure they get their content from the nearest CloudFlare's CDN server.



CloudFlare uses Anycast. However, we shift sites around between IPs frequently in order to, for example, isolate a site under DDoS from the rest of our network.

While it may be possible to create a IP-based CDN, my guess is the tradeoffs in terms of not being able to thoroughly defend yourself against attacks would not be worth the few milliseconds saved on the initial DNS lookup.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: