R – .net server control performance compromise

ajaxasp.netperformancepostback

We are finding that for a large sets of data server controls (with the amount of postbacks) they do often times result in a very slow performance.
While we don't want to do all the business logic in Javascript, we would like to speed things up.

What were your solutions/ideas? AJAX?

Best Answer

Two easiest places in ASP.NET to start and get the biggest gains:

  • Reduce ViewState. The ViewState can very quickly become unwieldy and even plain massive. I've seen developers inadvertently create pages that push down 20mb+ of ViewState. Every communication between client and server has to transmit that data. Here is a great roundup on how-tos for using the ViewState in a smart way.

  • Use the HttpRuntime cache. Once you fetch your data from wherever you're getting it (SQL or whatnot), store it in the cache. Always check the cache for the data before attempting to re-fetch it from the original source. The HttpRuntime cache is extremely fast.

    The cache link above has some good basic examples on how to add and remove items with the cache.