We’re all for faster websites here at The Industry. Whether it’s compressing images, converting images into CSS3 or even learning and brushing up on your code, we’re love it. It makes sense, then, when we discovered cdnjs, a Content Delivery Network specifically optimised for javascript libraries, to be pretty excited. I certainly am. So much so that I’m using cdnjs for my own website.
But wait! You’re wondering why you should use cdnjs, when there are plenty of other CDNs out there? CloudFlare, the creators of cdnjs, explain:
Everyone loves the Google CDN right? Even Microsoft runs their own CDN. The problem is, they only host the most popular libraries. We host the other stuff.
Right now, there are 127 javascript libraries hosted on cdnjs. Think that’s enough for you? I just use the JQuery library on my site. Even so, in my testing (I used the free webpagetest.org), cdnjs was noticeably faster than Google’s javascript CDN. My site’s score out of 100 from webpagetest.org increased from 86 to 89 after I switched from Google’s CDN to CloudFlare’s. The only improvement the service suggests I could make to Chasing Perfection is the use of a CDN for more content besides just javascript. Fortunately, that leads me on to the rest of the features which CloudFlare offer.
More than a CDN
CloudFare does a ton more than just provide a great CDN for us to use. Their goal is to supercharge your website — their tools increase security, can provide analytics and speed up your site. Whilst I’ve only used the javascript CDN so far, I’m seriously thinking about experimenting further with CloudFlare to see if I can speed up my page load times. If I could put my entire website behind a CDN service, my site could be even faster. They explain:
CloudFlare operates out of 14 data centers around the world. Our CDN automatically caches your static files at our edge nodes so these files are stored closer to your visitors while delivering your dynamic content directly from your web server. CloudFlare then uses a technology called Anycast to route your visitors to the nearest data center. The result is that your website, on average, loads twice as fast for your visitors regardless of where they are located.
Security
CloudFlare can help battle malicious bots using up significant website resources or slowing down your page load times. Even DOS attacks can be handled. Their security page explains:
CloudFlare’s technology automatically detects new attacks that arise against any website on its network. Once CloudFlare identifies that there is a new attack, CloudFlare starts to block the attack for both the particular website and the entire community. This also means the longer you are on CloudFlare, the better the protection becomes.
There’s even a post on the CloudFlare blog detailing how the service improves security for websites. I love the idea that it can detect DOS attacks as they’re in progress and start to deny the requests. That could save a ton of server resources. Even though CloudFlare has some extremely in-depth security features, the settings are simple and well designed:
Forget the confusing control panels of most security products. With CloudFlare, simply choose the security setting for your website. You can choose between I’m under attack!, High, Medium, Low and Essentially off.
CloudFlare is a paid service with a free plan. Statistics and analytics aren’t available on the free plan, but personally I’m much more concerned with speeding my site up than anything else. I’ll be playing with CloudFlare over the next few days and I’ll see if I can increase Chasing Perfection‘s webpagetest.org score into the high 90s. Have you used CloudFlare? Got any great stories to share? Comment on this article or say hi to either myself or The Industry on Twitter. I’ll be tweeting my findings on my account, @cgarmstrong, so if you’re not sure whether you want to give CloudFlare a go, keep watching and feel free to ask me any questions there!
