Tuesday, January 09, 2007

Scaling Crystal Reports

We recently deployed an entire web application which used Crystal Reports XI R2, the developer edition. The total application included about 40 different reports, including accounting reports, lead reports, and workflow reports. Most of the reports are blazing fast on a new Dual Opteron system, with 4GB of RAM, being run from with a Java container. However, one of the reports were taking an extraordinary amount of time.

How much time?
The actual query takes about 2 seconds to return more than 300 rows for 12 months. When running from with Crystal Reports, the same 300 rows takes more than 6 minutes to run.

Why?
This particular report uses a "super" report, and a "sub" report, both run inside of the Java container. Specifically, the Java program runs the Crystal Report "super" report, and then the Crystal Report "super" report runs the "sub" report for each, and every, row that is found in the "super" report. Which means that if the "super" report returns 300 rows, then it has to run 300 "sub" reports.

With the overhead of the Java container, the Crystal Report "super" program has to initialize and launch 300 separate copies. Each initialization takes several seconds, making it the slowest part of the actual report execution.

How To Solve?
We rewrote the two reports to utilize only one report, by refactoring some of the underlying tables.

How Much Faster?
The report now runs for 12 months of data in under 10 seconds, including creating a PDF for simple viewing.

0 Comments:

Post a Comment

<< Home