cancel
Showing results for 
Search instead for 
Did you mean: 

Significant Performance Difference: Designer Fast; ASP.net Viewer Very Slow

Former Member
0 Kudos

<pre>

I'm in the process of evaluation of CR2008 (and its runtime).

I'd appreciate if someone could shed some light on this problem:

I create a very simple report in the designer tied to a SQL Server 2005 view.

Nothing fancy. Just a lot of records: ~400,000

I preview it in the designer: initial page shows up after only 10 seconds,

it takes another 20 seconds to fully paginate all pages.

Navigation from page to page is split second.

I load the same report, same database in ASP.net on the same machine

(I even tried on different machines connecting to different databases).

Initial page appears in about 30 seconds. Navigation from page to page takes about 15 seconds.

I am baffled by this. Below I have listed all my settings and everything else i could find.

If i get anywhere near the designer performance, then I'd be very happy.

The ASP.Net page is built based on the samples and documentation provided on BO's web site.

Thanks

Jeff

Info:

Tools: Crystal Reports 2008 downloaded from the web site: 12.0.0.683

Visual Studio 2008 SP1

SQL Server 2005 Express (and I have tried it on the full version as well)

Data Access: OLEDB

ASX page:

protected override void OnInit(EventArgs e)

{

reportDoc = new ReportDocument();

reportDoc.Load(Server.MapPath("myreport.rpt"));

SqlConnectionStringBuilder sb =

new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);

ConnectionInfo connection = new ConnectionInfo();

connection.DatabaseName = sb.InitialCatalog;

connection.ServerName = sb.DataSource;

connection.IntegratedSecurity = sb.IntegratedSecurity;

if (!sb.IntegratedSecurity)

{

connection.UserID = sb.UserID;

connection.Password = sb.Password;

}

TableLogOnInfo logonInfo = new TableLogOnInfo();

logonInfo.ConnectionInfo = connection;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in reportDoc.Database.Tables)

{

table.ApplyLogOnInfo(logonInfo);

}

ReportViewer.ReportSource = reportDoc;

base.OnInit(e);

}

protected override void OnUnload(EventArgs e)

{

reportDoc.Close();

reportDoc.Dispose();

base.OnUnload(e);

}

The CR Control:

&lt;%@ Register assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral,

PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="cr" %&gt;

&lt;cr:CrystalReportViewer ID="crystalReportViewer" runat="server"

EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False"

GroupTreeImagesFolderUrl="" HasCrystalLogo="False" HasDrillUpButton="False"

HasPrintButton="False" HasSearchButton="False" HasZoomFactorList="False"

Height="1158px" ToolbarImagesFolderUrl=""

ToolPanelWidth="200px" Width="1059px" ShowAllPageIds="True"

ToolPanelView="None" HasToggleParameterPanelButton="False"

HasDrilldownTabs="False" HasToggleGroupTreeButton="False" /&gt;

Relevant web.config parts:

&lt;add key="CrystalImageCleaner-AutoStart" value="true" /&gt;

&lt;add key="CrystalImageCleaner-Sleep" value="60000" /&gt;

&lt;add key="CrystalImageCleaner-Age" value="120000" /&gt;

&lt;compilation debug="true"&gt;

&lt;assemblies&gt;

&lt;add assembly="System.Core, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=B77A5C561934E089"/&gt;

&lt;add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=31BF3856AD364E35"/&gt;

&lt;add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=B77A5C561934E089" /&gt;

&lt;add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral,

PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral,

PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral,

PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.Enterprise.Framework, Version=12.0.1100.0, Culture=neutral,

PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.Enterprise.Desktop.Report, Version=12.0.1100.0,

Culture=neutral, PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=12.0.1100.0,

Culture=neutral, PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral,

PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.Enterprise.InfoStore, Version=12.0.1100.0, Culture=neutral,

PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.Enterprise.Viewing.ReportSource, Version=12.0.1100.0,

Culture=neutral, PublicKeyToken=692FBEA5521E1304"/&gt;

&lt;add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/&gt;

&lt;/assemblies&gt;

&lt;buildProviders&gt;

&lt;add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider,

CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral,

PublicKeyToken=692fbea5521e1304"/&gt;

</pre>

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

See the article [Improving Crystal Reports Performance in Visual Studio .NET Applications|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/8029cc96-6ff3-2b10-47a2-b30ea790ea5b]

Also, don't forget to search these forums. There is tons of information on this topic here (most of it summarized in the article).

Ludek

Answers (2)

Answers (2)

Former Member
0 Kudos

reportDoc.DatasourceConnections[0].SetConnection() worked nicely for me. thanks

Former Member
0 Kudos

Problem with not looping through the tables though is that if your report pulls from multiple datasources the login information may be incorrect for one of the datasources.

The storing a ReportDocument in a Session/ViewState maybe something to play with, however I have no had much success with as when I have tried to do it in the past Post/Call backs did not execute properly and the Viewer would either nto submit my parameters to the report or it would not page through the report.

Anyone have any success with setting a CrystalViewer.ReportSource to a ReportDocument returned from a Session variable?

Thanks!

Former Member
0 Kudos

<pre>

Ludek, great article!

I went through almost all of it and the links as well.

Most of this does not apply to my case. In my case, the very same report peforms differently.

However, I went and created an even simpler test case to see what's going on.

I realized that the same report performs almost the same in both environments as long as I do not change any tables or connection info on it.

However as soon as I place the code(see my previous post) in OnInit() to change the logon info, the behavior changes completely.

In the case of no OnInit(), paging within the report is split second both in designer and in asp.net. However, overriding the logoninfo changes that dramatically from split seonds to 10-20 seconds.

You had a link for CR10 that kind of talked about either saving the report after chaning the connection or using mulitple reports. Do you have more information on the first option? Do you think a piece of code in the global.asax to change all rpt files upon the start of the application would be a good idea?

I would then have to give the asp.net user "write' privileges to where my reports are.

thanks

jeff

</pre>

former_member183750
Active Contributor
0 Kudos

This code:

protected override void OnUnload(EventArgs e)

{

reportDoc.Close();

reportDoc.Dispose();

base.OnUnload(e);

}

is creating and destroying the reportdocument on every postback which is a re-load of the report. Persisting the report in Session and retrieving from session on postbacks should show an increase in performance. E.g.; something like this;

Dim rptDocument As ReportDocument

If Not Me.IsPostBack or Session("Report") = Nothing Then

rptDocument = New ReportDocument

rptDocument.Load(sGlobalPath & "\myreport.rpt";)

.

.

.

Also, when changing the logonInfo, try not looping through all of the tables, but rather applylogoninfo to the first table allowing the change to propagate down to the other tables. Another method worth trying may be to use reportDoc.DatasourceConnections[0].SetConnection(). This may also show an improvement over looping through the tables.

Ludek