This is a migrated thread and some comments may be shown as answers.

Dynamic loading a PageView takes ages!

9 Answers 289 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Jelte
Top achievements
Rank 1
Jelte asked on 19 May 2010, 09:15 AM
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

9 Answers, 1 is accepted

Sort by
0
Jelte
Top achievements
Rank 1
answered on 20 May 2010, 01:28 PM
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
0
Dimitar Milushev
Telerik team
answered on 21 May 2010, 12:25 PM
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.
0
Jelte
Top achievements
Rank 1
answered on 21 May 2010, 12:57 PM
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


0
Dimitar Milushev
Telerik team
answered on 26 May 2010, 04:46 PM
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.
0
Jelte
Top achievements
Rank 1
answered on 31 May 2010, 08:59 AM
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
0
Dimitar Milushev
Telerik team
answered on 04 Jun 2010, 02:35 PM
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.
0
Giuseppe
Top achievements
Rank 1
answered on 08 Jan 2015, 05:58 PM
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
0
Jelte
Top achievements
Rank 1
answered on 09 Jan 2015, 07:14 AM
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.
0
Boyan Dimitrov
Telerik team
answered on 13 Jan 2015, 02:44 PM
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.

 
Tags
TabStrip
Asked by
Jelte
Top achievements
Rank 1
Answers by
Jelte
Top achievements
Rank 1
Dimitar Milushev
Telerik team
Giuseppe
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or