Dynamic loading a PageView takes ages!

10 posts, 0 answers
  1. Jelte
    Jelte avatar
    15 posts
    Member since:
    Jul 2008

    Posted 19 May 2010 Link to this post

    Hello,

    Our project uses several UserControls that are used on different pages.
    We load these UserControls dynamically in the page whenever they are needed.

    This all works great, and fast, in our development environment.
    But when we run it on the production server it takes ages.

    We narrowed down the "slowdown" to the following lines of code:

    Trace.Write("RegiStar""Start toevoegen mat_Ereigniseingabe"); 
     
            string userControlName = "Mat_Tab_DetailInventar.ascx";  
            Control userControl = Page.LoadControl(userControlName); 
            userControl.ID = e.PageView.ID + "_userControl"
            e.PageView.Controls.Add(userControl); 
     
    Trace.Write("RegiStar""einde toevoegen mat_Ereigniseingabe"); 

    This part of code takes .09 seconds on our development machine but takes almost 17 seconds on our production server.
    What could make this run so slow?

    When we trace the PageLoad in "mat_tab_detailinventar.ascx" we see that there is no delay there. It runs almost as fast as on our development server.

    For your information.
    Our development machines are all English wit XP. The production server is a German Win2003 SBS server.

    Does anybody have an idea?

    Thanks

    Jelte
  2. Jelte
    Jelte avatar
    15 posts
    Member since:
    Jul 2008

    Posted 20 May 2010 Link to this post

    Hello,

    Does anybody have an idea?
    I mean, it really looks like the Telerik control is doing something and i dont know how i could solve this.

    Jelte
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 21 May 2010 Link to this post

    Hello Jelte,

    Adding a control to the PageView's controls collection is simple operation and only appends a reference at the end of the collection. Can you please try tracing this line only:

    Control userControl = Page.LoadControl(userControlName);

    Loading the control includes the .ascx file being parsed by ASP.NET which could be a slow operation if the file is large. Also, the Control's life-cycle includes much more than the PageLoad method so it is possible another event in the life-cycle is causing the slow performance.

    Sincerely yours,
    Dimitar Milushev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Jelte
    Jelte avatar
    15 posts
    Member since:
    Jul 2008

    Posted 21 May 2010 Link to this post

    Hi Dimitar,

    Thanks for your response.

    I Traced the code like this :
            Trace.Write("RegiStar""Start toevoegen mat_Ereigniseingabe"); 
     
            string userControlName = "Mat_Tab_DetailInventar.ascx";  
            Control userControl = Page.LoadControl(userControlName); 
            Trace.Write("RegiStar""Control userControl = Page.LoadControl(userControlName) -  geladen mat_Ereigniseingabe"); 
     
            userControl.ID = e.PageView.ID + "_userControl"
            e.PageView.Controls.Add(userControl); 
     
            Trace.Write("RegiStar""einde toevoegen mat_Ereigniseingabe"); 

    The Bottleneck is in the "Control userControl = Page.LoadControl(userControleName);" part
    That line of code takes up most of the time.

    How can i find out where this delay is happening?
    The ascx file isn't that big. I think there are, at most, 20 controls on that page databound in a formview.
    Other pages, also with formviews run lightning fast.


    Thanks,
    Jelte


  6. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 26 May 2010 Link to this post

    Hi Jelte,

    You can try ASP.NET's built-in tracing - I think it will give you more information than trying to manually trace the application.

    Best wishes,
    Dimitar Milushev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Jelte
    Jelte avatar
    15 posts
    Member since:
    Jul 2008

    Posted 31 May 2010 Link to this post

    Hi Dimitar,

    Thanks for the suggestion but we already did that.
    The problem really seems to focus on that one line. "Control userControl = Page.LoadControl(userControleName);"

    i made an ASPX page with the same controls linked to the same datasource.
    This page loads really fast.
    This tells me that its not the controls on that page which is making it slow.

    I need a solution to this problem, the speed in production is really not acceptable.

    Any suggestions would be welcome.
    We would drop the whole pageview thing if it were possible. But the current design of our program makes so that we cannot do without it.

    Regards,
    Jelte
  8. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 04 Jun 2010 Link to this post

    Hello Jelte,

    I would try removing parts of the code/controls in the User Control and testing the performance of LoadControl until you are able to pinpoint what exactly is causing the issue.

    I am sorry I can't be more helpful here.

    Best wishes,
    Dimitar Milushev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. Giuseppe
    Giuseppe avatar
    3 posts
    Member since:
    Sep 2013

    Posted 08 Jan 2015 in reply to Jelte Link to this post

    Hi Jelte,

    I'm experiencing the same problem with .net 4.0 IIS8.
    How have you solved your problem? So I can try if it's work for me also.

    Regards
    giuseppe
  10. Jelte
    Jelte avatar
    15 posts
    Member since:
    Jul 2008

    Posted 09 Jan 2015 in reply to Giuseppe Link to this post

    Hi Giuseppe,

    Sorry to say we never found a workable solution.
    We ended up rewriting our framework seeing that there wasn't any solution offered by the Telerik team.
  11. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 13 Jan 2015 Link to this post

    Hello,

    As Dimiter explained the easiest way to investigate such performance problem is to remove parts of the code/controls in the User Control and test the performance of LoadControl until you are able to pinpoint what exactly is causing the issue.

    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017