javascriptasp.nettelerik-gridpagemethodsie8-compatibility-mode

Improve ASPX page performance with Telerik grids


My question is related to the improving performance of the aspx page. So after reading this Post, please comment whether it is even possible to improve the performance of this page.

Here is the scenario.

I am working on one asp.net web application with following tools

  1. .Net 3.5
  2. Typed Dataset(10 tables)
  3. IE 8 Compatibility View-IE7 Standards(App does not work on FF,Chrome or any other browser)
  4. Telerik RadControls. (Grid(s), Numeric Textboxe(s), Dropdowns with autocomplete)
  5. App Fabric Cache.
  6. Jquery and other page specific javascripts.

ASPX Page contains

  1. 8 Grids (out of which 6 are telerik grids and 2 are html tables)
  2. All telerik grids have EditFormTemplates defined.
  3. Lot of controls(I dont event know how many controls are really used, so I am not much keen into cleaning up the aspx page, as this might require lot of dev/qa efforts, which unfortunately is not an option right now.)
  4. Lot of javascript inside the RadScriptBlock.(We also have javascrtip that fiddles around the width and other UI of the grids)
  5. ViewState is enabled for all grids and controls on the page.

The operations on these grids are - Insert, Update, Delete, Copy, Remove all.

All these operations are done throguh parital postbacks.

There are not many database hits as most of the data is cached in appfabric.

Now this might sound weired, but there are thousands of lines of code in this single page. Approx 30k lines in code behind, 5k lines in jS and around 4k lines (html/js combined)in the aspx page. There is complex logic in the code behind which runs on page load as well as every partial post back, and most of the grids are rebind(ed) on almost every postback.

Things we did to improve performance(which did not help much). Note: Rewriting the entire page again was not an option so all the enhancements had to go in this page.

  1. Minified all javascripts, CSS
  2. Added all scripts in Radscript mangaers Script collection(I dont know if this would help in any case, but was told to do so.)
  3. Moved all the javascript written on aspx to js files from RadScriptBlock
  4. Refactored lot of code and minimized the use of appfabric(push,get).
  5. RadCompression is already implemented.
  6. All Grids use server-paging (5 records per page).

Page has hardly any static contents. Page Caching, Fragment caching is not possible looking at the usage of this page

I dont know if this surprises anyone, but the partial postback operations on this page takes around 4-6 seconds(Request+Response+Render). I think that is pretty fas, looking at the code that is running in the background. But the client doesn't feel like that.

The expectation is that any operation on the page should not take more than 1-1.5 seconds.

Questions

  1. Is it possible to get this performance boost looking at the infrastructure used in this page
  2. If at all it is possible what are the things that I am missing and that could make the page perform better.
  3. I have seen that the ItemCreated and ItemDatabound of each grid is called lot many more times than the RowCount. I know this is called for each Item i.e Header, Footer, and Items, but if I have a row count of 5 why are these methods called more than 10 times?
  4. I have seen in the code that the developers have used Rebind() method like crazy(May be this is the reason for #3). Can any one tell me what is the correct way and location to call Rebind? I know that Telerik grids calls rebind implicity on inserts, but in what scenario do we need to call rebind explicitly?

I am trying to review the entire code base and trying to find out the bottlenecks.

I would really appreciate if anyone gives me any kind of advise which I am ready to try out on the code.

Let me know if any more information is needed.

Thank You.

EDIT

Further to the analysis, I have checked the viewstate of the entire page and it is around 33kb. Also, when I removed the AjaxSettings from the page the page loads pretty fast in 2/3 seconds. So I feel the Ajaxification of the page is creating some problem in rendering the page.

I also logged the server process timings and it takes around 1/2 seconds based on which grid is in action.


Solution

  • After lots of analysis, and digging through different layers, we found out there were couple of stored procedures that were the culprit. Uncessary calls were also identified to procedures, which was slowing down the page quite a bit. Fixing that gave us good performance boost. Also we had to make some tweaks in the grid rendering events.

    Not sure if this answer helps someone in the future, but I hope at least it would give some pointers. Dynatrace came real handy in this excercise.