Increasingly when developing sites I find myself utilising more client side technologies such as Javascript, jQuery and AJAX.
For three different pages I measured the size of the HTML sent to the browser (excluding images and CSS).
What I found was:
-
A page that has normal ASP.NET controls + a little bit of jQuery: approx. size = 30kb
-
A page using some user controls that have AJAX and client side support: approx size = 50kb
-
A page that uses more complex user controls from a library with heavy client side support: approx. size = 110kb
As you can see the size of data transferred seems to increase as client side support and AJAX features are added.
This adds to the bandwidth requirements of the site and presumably the servers I/O load which may reduce the number of concurrent users that can be served.
Should I worry about balancing rich client side features and interactivity with server's load and bandwidth use?
What are the priorities, if any?
Best Answer
Are we supposed to use these features (javascript, jQuery, AJAX, etc..)?
Depends on your requirements for building an application. Use the tools that provide acceptable solutions to your needs.
If so why does it make such big difference in the size of pages?
I'm not quite sure if you are looking at just the page or the entire request. Most of the JavaScript I would assume is in separate files that can be cached by the browser. So the first request might be big, but subsequent requests would be much smaller. (Also to take more load off your server, look into using a CDN)
Is it the way I have used them or is it a common problem (I've heard so).
?Since you haven't provided us any code or examples, it could be the way you've used them. Or it could be the controls you've attempted to use. I've noticed that Telerik controls seem to be quite bloated, but that is my own opinion.
How do I balance page interactivity and server's load?
These are mostly independent from each other. It is possible to create a very interactive page that can be either more or less load on the server (load I assume is CPU/Disk time). In my opinion, AJAX for the most part simply reduces the number of times complete layouts have to be sent by the server to the client which; is less bandwidth and slightly less load on a server due to the lack "rendering" html.
What are priorities?
Highly depends on your application requirements. It sounds like you've jumped off a diving board into a big pool of web based opportunities, but don't know where to swim to.
I am mostly using
JQuery
, which has a lot of very good useful features:Granted I have to program features myself.