The ASP.NET UpdatePanel and Performance


I was chatting with someone at the event Mark and I did earlier today about the UpdatePanel in ASP.NET AJAX and I realised afterwards that I may have given a rather pessimistic view of performance so let me correct that here. The gentlemen was primarily concerned with network performance and optimising traffic.

As the UpdatePanel is optimised in the first instance for ease of use, I suggested that he may need to look beyond the UpdatePanel to other ASP.NET AJAX capabilities to tweak his app for optimum performance (eg using the web services support to call a web service and writing his own JavaScript on the client to update the UI – this gives you much more control and allows you to optimise the request / response). Of course there’s always a trade-off – the UpdatePanel is a cinch to use but if you need that extra grunt then you’ll want to take more direct control.

On the other hand, the UpdatePanel does a lot to improve matters over a page postback so you get a big benefit just from wrapping key elements to be updated in an UpdatePanel. eg, here’s some data I just collected using Fiddler.

Postback
Viewstate Enabled Sent 5,514 Received 20,759
Viewstate Disabled Sent 1,019 Received 15,748
UpdatePanel Update
Viewstate Enabled Sent 5,461 Received 6,413 (-69%)
Viewstate Disabled Sent 886 Received 1,835 (-88%)

This data was collected using a DataList page from my demo site where I bind a DataList to some XML data. In the AJAX Callback version I dynamically render UpdatePanels for each of the “Price” fields in the ItemTemplate (the DataList is rendering some stock info such as high / low / current price etc)

So you get a significant gain by just introducing ASP.NET AJAX and the UpdatePanel and if you need to you can take this even further by tapping into lower-level features of ASP.NET AJAX such as web services support or the network stack.

Technorati tags: , , ,

Comments (4)

  1. Hoy en cosas interesantes: Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint

  2. Phil Winstanley (Plip) tried to leave the following comment relating to my blog post about UpdatePanel

  3. toy says:

    mike –

    can we take a look at the source for the demo site?

    if yes – where is it?

  4. MikeO [MSFT] says:

    Sure you can. You can find it in my blog post of 2nd Feb (http://blogs.msdn.com/mikeormond/archive/2007/02/02/asp-net-ajax-demo-site.aspx). The page I used was the Templates.aspx page in the 02_UpdatePanel folder. In the UpdatePane, comment out the random number generator (that’s just for demo purposes to show fictitious prices) and uncomment the binding expression. The styling and layout of the site are different from the one I tested (I used my original site before modifying it for download) but you should see very similar results. Mike

Skip to main content