Home
Analytics
Report Engine very slow
JanaF
Hi,
we are using the Birt Report Engine in our application to print reports to pdf. Which works fine so far. The problem is that running the method IRunAndRenderTask org.instantview.report.exec.ExecuteReport.executeTask.run() is very slow: it takes 15 seconds to build a report consisting of 5 entries.
Do you have any idea, why it is so slow and what I can do to make it faster?
I am using a xml-data-source, the "birt-runtime-osgi-3_7_2", and a simple table-report.
Thank you in advance,
Jana
Find more posts tagged with
Comments
mwilliams
I'm not sure what your design or XML look like or how much data you have. Those can all have some effect. I believe that using separate run and render tasks is supposed to be faster than using the runAndRender task, so you might try modifying your code to use the separate tasks, to see if it helps.
JanaF
Hi,
thank you for your reply. I tried to use a seperate run and render task as you suggested. I used this example as a guide:
http://wiki.eclipse.org/Separate_Run_and_Render_(BIRT)_2.1
The time for the creation actually increased. The time consuming method is the creation of the document: runTask.run("c:/temp/name.rptdocument"); the method IRenderTask.render is actually quite fast now.
Maybe the example is too old (as it is the 2.1-version) and the seperate run and render task should be implemented differently?
Do you have any other ideas?
mwilliams
How large is the xml file that you're using that your 5 entries come out of? 15+ seconds does seem like a long time for such few lines. Could you attach your design? Even better, could you attach an XML file and a sample report that uses it that has this issue for you, so I can test it?
JanaF
Hi,
I couldn't find the file I was talking about, so I attached a report-design which includes a table and a xml-file which is used for the 13 entries in that table.
I tested the performance several times and I went from 15 seconds to 7 seconds. But usually the report with exact the same data is just open once. So the 7 seconds do not really help.
Thank you for your help!
CBR
BIRT uses XPath to parse the XML files.
While XPath ensures that you get a maximum of flexibility it is also slow as ****.
Have a look at slide 18 and 19 of presentation mentioned here:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/371-designing-high-performance-birt-reports/
I would not use the XML oda if you have the need to deliver high performance reports. JAXB is indeed much faster but also requires a lot of manual coding as mentioned in the slide. You do not want to maintain that code if your xml schema changes very often. Is there a way you can transform the XML into a database? Or can you describe your use case a bit more detailed?
CBR
Oh i ve just downloaded your files and i agree with mwilliams. 15 seconds is really too long for such a small file.
What exactly is taking 15 seconds? Can you post your sourcecode that you are using for testing?
In a normal environment you would not startup birt for every report. This is taking a lot of time but once you have started it up in your code you should keep the reportEngine object alive and use it for every report beeing requested. In addition this object is thread safe which means that it can process multiple reports at the same time.
JanaF
<blockquote class='ipsBlockquote' data-author="'cbrell'" data-cid="113270" data-time="1358249270" data-date="15 January 2013 - 04:27 AM"><p>
[...]<br />
What exactly is taking 15 seconds? Can you post your sourcecode that you are using for testing?<br />
In a normal environment you would not startup birt for every report. This is taking a lot of time but once you have started it up in your code you should keep the reportEngine object alive and use it for every report beeing requested. In addition this object is thread safe which means that it can process multiple reports at the same time.<br /></p></blockquote>
<br />
Hi cbrell,<br />
<br />
My programm takes the following times for the following tasks:<br />
Platform startup: ~4 sec<br />
First runReport: ~6 sec<br />
Second runReport: 1.6 sec<br />
Platform shutdown: ~6sec<br />
<br />
I have added a second "runReport" because I noticed it to be much faster than the first run. (Maybe some initialisation is still taking place?)<br />
<br />
So you are saying one would keep the engine-object alive. However, my process is being shut down after the report is done.<br />
Is there a best practice or an already written Windows service which runs in the background to wait for any report to be run? Or do I have to reinvent the wheel?<br />
<br />
I am looking for something like genReport.bat which just does this basic thing (and hopefully is good at it ;-)).
CBR
Hi JanaF,
you are totally right. BIRT is starting up in a lazy manner which means that the components are initialized the first time they are beeing used. To be as fast as possible you would have to start up the platform and run a dummy report which is comparable to your reports. This run will make sure that all components are intialized. After they have been initialized they will be alive until you shutdown the platform.
Can you describe how you want to use the report engine? Do you have an application that uses BIRT? Is this application written in Java? Unfortunately there is no windows service available that running in the background.
genReport.bat is unfortunately very inefficient concerning the performance because it starts up the platform, generates a single report and shuts it down. So you probably spending more time starting and stopping the platform then generating the report.
I can think about some alternatives (if there are any) if you describe your infrastructure and architecture.
JanaF
<blockquote class='ipsBlockquote' data-author="'cbrell'" data-cid="113324" data-time="1358366959" data-date="16 January 2013 - 01:09 PM"><p>
[...]<br />
Can you describe how you want to use the report engine? Do you have an application that uses BIRT? Is this application written in Java? Unfortunately there is no windows service available that running in the background.<br />
genReport.bat is unfortunately very inefficient concerning the performance because it starts up the platform, generates a single report and shuts it down. So you probably spending more time starting and stopping the platform then generating the report.<br />
I can think about some alternatives (if there are any) if you describe your infrastructure and architecture.<br /></p></blockquote>
<br />
Hi cbrell,<br />
<br />
Thank you for ministering our problem.<br />
<br />
Our situtation is the following: We have a C++-Application running which sometimes needs to run some report. Right now we are using something simmilar to genReport.bat to run these. However, as you mentioned, times are mostly spent on starting up and shutting down, getting users frustrating times.<br />
<br />
Our idea was to create some process which starts up the engine and then loops forever, waiting for any reports to be printed. We just thought this was such a common problem that somebody probably had implemented it already. Are you aware of something like that?
CBR
Thanks for the insights.
Unfortunately you have to reinvent the wheel. There is no real component that allows that kind of integration. The easiest and probably cheapest solution would be the following:
1) Use the BIRT Webviewer
2) Download Apache Jetty: Jetty is a lightweight Java servlet container. It is needed to run the Webviewer
3) Deploy the Webviewer to that Jetty
4) Your software starts Jetty via command line
5) If user wants to generate a report simply call a url on the Jetty. The Webviewer will know what to do because all parameters can be set using the url (have a look at:
http://www.eclipse.org/birt/phoenix/deploy/viewerUsageMain.php#parameters)
6) Jetty will deliver the generated report if you call the correct url
Advantages:
- nearly nothing to implement on your side
- Jetty is lightweight and could be started up relativley quick
- Jetty waits for new requests in background without slowing down the system
- supports multithreading (e.g. generate more then one report at a time)
Disadvantages:
- Jetty contains a webserver which means that you have to start up a webserver on the client. Therefore a port needs to be bound. Not sure if company policies allows that. In addition you have to think about a strategy if the port is already taken (but solveable because you can give the port to be used during the startup as a command line parameter)
Jenkinsj5
If you had a report that automatically refreshed every couple of seconds, would that keep it from shutting down, or would the refresh have to wait for the shutdown and start up?
CBR
Hi Jenkins,
this totally depends on how you integrate BIRT in your application. The genReport.bat starts up and shuts down the engine every time. If you integrate BIRT into your java application you have full control on how BIRT is integrated. As i already wrote:
You should start up the platform get a reference to engine object and keep that reference. Once all reports are finished (e.g. your application is closed) you should shut it down.
There is no gain in executing a report every second. It only depends on how you ve integrated BIRT.
The BIRT Webviewer does basically the same thing. It starts up the BIRT engine the time the webapplication is initialized. During startup of the webserver it executes the code to initialize the engine. The engine object is kept alive until you undeploy the Webviewer from the appserver or you shut the appserver down.