I have a page that has 5 sections. Each section takes about 1 second to render.
Page_Load()
{
RenderSection1(); //1 sec
RenderSection2(); //1 sec
RenderSection3(); //1 sec
RenderSection4(); //1 sec
RenderSection5(); //1 sec
}
I would like to speed up the loading of this page. But at the same time make sure that it don't slow down performance of other parts of web application and also do not crash the IIS.
The are several approaches:
Use AJAX requests. Needs to be MVC style requests to Controller or Web Service.
Using UpdatePanel around each section will not work - since if I try to submit refreshes to multiple UpdatePanels at the same time using approach here: http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/, the last request will always win: http://www.codeproject.com/Tips/57035/Simultanious-Async-Requests-Using-Multiple-Update-.aspxUse ASP.NET threads described in answer to right way to create thread in ASP.NET web application. So I would use a separate thread for each call: RenderSection1, RenderSection2, etc...
Move the logic that takes up time, usually DB requests, into Application Service class in another DLL or External Web Service. Something like
OrderDTO GetDataForViewOrder(int orderID)
{
}
and use multiple threads in that DLL. This approach seems to provide the best scalability, but also introduces UI details into Application Services layer.
Which approach do you think is the best and why?