Sunday, 9 June 2013

Free CDN using Google drive and Google sites

Content Delivery Network

Lately we have been trying to improve our site speed and response times in an effort to make our website load quicker so we are not wasting our visitors time and have a more responsive site.

The approach we decided to use was distributing our resources a little more by using Google Drive and Google Sites as a kind of CDN to host our images, CSS and JavaScript.


Distributing Content

Our aim is moving some of the request off our server and onto Google which should help provide a speed increase because our server is doing less and Google has a lot more resources and very respectable response times.

We setup an account with Google using a gmail address this will be the main account for our  Google Drive and Google Site we also use this account as our publisher Google+ account.


Google Drive logo
Google Drive
Once the account had been created we decided to use Google Sites for all static images and JavaScript and Google Drive for external CSS file.

We tried to use Google Sites for hosting CSS but Chromium did not like it and failed to apply the style sheet to the page although it does work for images and JavaScript.

Google Site was the easier of the two to use and has a nicer URL scheme than Google Drive it is a shame it does not serve CSS files. One disadvantage of using two hosts for CDN is it doubles the number of DNS requests.


Optimising Files

Another consideration we had was if we could make the files we are serving up to be a bit more efficient and smaller in size.

We first compressed our CSS files which gave us a 32% reduction in file size we used csscompressor to shrink them then modified the CSS file which are now hosted on our Google Drive.


A picture of a yellow steam roller
Compress


The next obvious one for us to do is reduce the file size of our JavaScript for this we decided to use javascriptcompressor which gave us a saving of nearly double which sounds like a good saving for such a simple task.

Again we updated our JavaScript files which are now hosted on Google Sites which provides revision history for files as does Google Drive although we still use subversion to manage our uncompressed copies of theses files.


Conclusion

There are a number of other things which we can do to further optimise our website speed and response times and we will be publishing an article about these further optimisations in the future.

We have been very busy finishing the development of our care news system and it is now in feature freeze and QA will be starting on Monday. Very happy with the progress so far and we feel this system will offer our visitors some fresh content.

No comments:

Post a Comment