Welcome to Internet Software Sciences Newsletter – January 2016
Pros and Cons of CDN (Content Delivery Network or Content Distribution Network) as a library code source for Web+Center and most applications today.
Graphic showing non CDN vs CDN models of web application code distribution
The world of software programming has evolved from the days when all or most of the “code” – libraries, functions all resided on the computer (web server) or local network on which it was running on. Today with our complex Web applications, much of the code that you run today today, including web objects (text, graphics and most importantly scripts libraries), and downloadable objects (media files, software, documents) all come from on-line CDN hosted websites that often dynamically loads with every page load and mouse click!
To explain this in simple coding terms, previously if your web application referenced some library scripts and code libraries, it would reference them on files locally stored on your server computer with a mechanism pointing to a local relative computer directory like:
<script type=”text/javascript” src=”../../jquery.min.js”></script>
Now most of the scripts, libraries, functions, fonts, styles, etc are referenced on a Internet hosted CDN that are referenced like:
<script type=”text/javascript” src=”http://code.jquery.com/jquery-1.6.min.js”></script>
In order for the application to work properly, you must have a fast and available Internet connection and the file residing at the CDN must exist, and be current and compatible with your application. In this example, that url is:
http://code.jquery.com/jquery-1.6.min.js
If the website http://code.jquery.com is hacked or unavailable or if the file jquery-1.6.min.js no longer exists, broken, hacked or incompatible, or if your Internet connection is slow, your application may break or be compromised in ways difficult to predict and repair.
Web+Center and CDN options
Starting with the jQuery mobile framework we used to develop the Tech+Mobile and Customer+Mobile applications, we already have code that is dependent upon 3rd party scripts, code, and styles. With most HTML development environments, you can choose to get your various code libraries and styles files locally or through an on-line CDN during the initial coding process. To allow our Web+Center code to function without an Internet connection, the Tech+Mobile and Customer+Mobile code uses the locally accessed JS scripts with syntax:
<script src=”my.js”>
You can find a “my.js” file locally in the customermobile directory. We originally developed our mobile apps with remote access for the jquery mobile libraries, but moved them from a CDN to part of our actual local file install. We gained some independence from website and compatibility issues but also lost the ability for updated versions of those files to automatically updated.
Should Web applications use CDN or locally defined files?
Wikipedia definition and description of CDN lists many advantages of having multiple sources of these commonly accessed files including:
- Better performance and availability
- Possible savings for content provider
- A degree of protection from DoS attacks
- Security Patches to code
Why this is important information?
Just this week, the Internet Software Sciences company WordPress website (https://www.inet-sciences.com) that is hosted at a business class WP hosting company (wpengine) had to move all of their clients, including Internet Software Sciences website, to a new hosting provider since THEIR hosting provider was experiencing continual DoS attacks. This lead me to better understand vulnerabilities and unpredictable nature of the Internet. With many applications now dependent on exact external website connectivity, file existence and code compatibility is something to evaluate and understand as applications add additional Internet dependencies.
Version 9.0 of Web+Center will certainly include new HTML 5 frame works that will need to reference either locally defined scripting libraries or remote ones. We have to decide which approach best serves the needs of our users. Feel free to forward your preferences or experiences for CDN or non CDN applications.