While I understand this question is fairly vague since I’m not giving you all as much detail as I’d like to, I’m hoping for some general improvements that can be made to my generation code or the reports themselves to speed them up. I’ve asked for more hardware, but have been denied.
public Stream GenerateReport(string reportName, string format) { if (reportName == null) throw new ArgumentNullException('reportName'); reportExecutionService.LoadReport(reportName, null); string extension; string encoding; string mimeType; ReportExecution2005.Warning[] warnings; string[] streamIDs; byte[] results = reportExecutionService.Render(format, null, out extension, out encoding, out mimeType, out warnings, out streamIDs); return new MemoryStream(results); }
The reports themselves are taking 6-10 seconds each. I’ve narrowed down the bottleneck to Reporting Services itself. Where should I start looking to removed potential speed bottlenecks. Note: some code has been removed to protect the innocent.
Although not directly related to the code you posted, here are a couple of generic enhancements you should always consider when writing reports in Reporting Services:
Pre-load report tables so that they already aggregate any data that would have been aggregated in the report. For instance, if the report data source summarizes thousands of rows of data and requires joining multiple tables together, then you should create a pre-aggregated table that joins all the data together and already summarizes the data at the required grain for the report.
If you are passing parameters into the data source, then the aggregated underlying table should have a clustered index that corresponds with how the table will be searched. For instance, if the report only displays data for an individual customer and for a given transaction date range, then the clustered index should be ordered on the customer and transaction date.
Filtering data should occur in the data source query and not in the report itself. Meaning, if you parameterize your report so that it filters data, then the parameters should be passed to the database so that it returns a smaller set of data. Do not return a large set of data and then filter the data. It is easy to make this mistake when using a multi-valued parameter since the out-of-box instructions for using multi-value parameters is to filter the data AFTER the data has been returned to Reporting Services.
I hope you are already doing the above and that this is not a relevant post. 🙂