ASP.NET and AJAX tips

I found a couple articles regarding performance and scalability for ASP.NET, and ASP.NET with AJAX. I think these are a good read for anyone doing development with these tools.

This CodeProject article has some excellent tips about AJAX, regardless of the technology or library you’re using to implement it. It looks like some of the tips are outdated. However, there is another more recent article written by the same author that is both current and chock full of juicy details. I summarize a couple of the concepts here. Remember, some of the concepts are outdated but these ideas can be translated into other kinds of projects, so it’s all worth consideration. In particular, while most of the tips in the first article are related to batching, I’m not sure ASP.NET even does batching anymore. I need to look this up.

One good point is that bad calls make good calls timeout if they’re batched. So if there is a lot going on in a given update and any one of the operations goes sour, a large segment of your page might be disfunctional.

Another good point is that batch operations are good for small operations, but not for big operations. This is because the real time for processing them is shorter than synchronous operations, but the time perceived by the user is actually longer, since now they have to wait for a batch up updates to return all at once rather than seeing controls replot one by one. The difference is that the user perceives quicker response time if they see one thing happening, then another, then another, compared to wait, wait wait, then everything plots at once.

So if you want faster perceived response time, you send multiple small requests. However, the article goes on to say browsers can only process two simultaneous requests, that they do not respond when more than two calls are in the queue, and that there is no specific order to the processing of requests in the queue. The proposed solution is to create and manage your own browser queue to avoid massive page lockups.

A final point worth considering is that an HTTP POST is more expensive than a GET. In short, it seems best to use POST when submitting data, but use GET when retrieving data.

So that’s what’s in the first article. How much applies to current development? I don’t know yet but I do know that this is a topic that I should do more reading on, and before I read the article I wasn’t really thinking about that sort of optimization.

For anyone who is thinking about optimization – hold onto your hat because the second article is a real whirlwind of a trip. The "10 ASP.NET Performance and Scalability Secrets" has information from the author’s blog and his book, but also a couple that aren’t found elsewhere. I won’t even go into a summary here. All I can say is, if you are using ASP.NET, especially with AJAX, check it out! Check out his blog and book too.

I know you’re reading a blog now, but if you’re doing development there are SO many blogs out there where people are sharing their knowledge. I strongly encourage you to look for blogs at MSDN, blogs by Microsoft MVPs, and other tips from people who really are gurus in their field. The internet has a lot of crud to filter through, especially silly blogs and sites like MySpace, but it seems to be getting easier to find higher quality wisdom than it used to be. Carpe diem.

Leave a Reply