Report render is very slow and timesout consistently (after 30sec) with version 2.2.0
-
After upgrading to 2.2.0, report rendering takes longer than previous version. With a simple one line html file render takes ~25sec using below.
jsreport.exe render --template.engine=none --template.recipe=chrome-pdf --template.content=hello.html --out=out.pdf
Here is the output I capture;
C:\inetput\sitename\jsreport\temp\dotnet\binary-default-2.2.0.0>test.bat started at [2018-10-06 08:17:58.203] starting rendering process.. rendering has finished successfully and saved in: C:\inetput\sitename\jsreport\temp\dotnet\binary-default-2.2.0.0\out.pdf started at [2018-10-06 08:18:22.818]
With real data, I have timeout consistently as the error shows below. Any suggestion to resolve this issue? The file size of jsreport.exe has been increased drastically from the previous version (141MB vs 20MB), not sure what has been added to make such increase.
jsreport.Local.JsReportBinaryException: Error rendering report: A critical error occurred while trying to execute the render command: Timeout Error: pdf generation not completed after 30000ms (1). caused by error (1) -> meta = {"remoteStack":"Error: Timeout Error: pdf generation not completed after 30000ms at Timeout.setTimeout [as _onTimeout] (jsreportRuntime.js:133651:19)
-
The file size of jsreport.exe has been increased drastically from the previous version (141MB vs 20MB), not sure what has been added to make such increase.
The v1 uses tiny library for converting html to pdf called phantomjs. Unfortunately this library is no longer developed and maintained. We had no other choice than to start using different library as the default in jsreport.
The v2 uses chromium for converting html to pdf. It supports the latest html/css/js standard and it is under heavy development. Unfortunately this dependency is huge and there is not much we can do about it. However it is still the best choice for the most of the use cases.The both libraries works differently. It can happen that one is faster on specific html and the other faster on different html.
How complex is your input html? Maybe you can share it?
-
Thank you for the response.
My above test was using a single line html which takes ~25sec. Below is the HTML;<html><body><h2>hello</h2></html></body>
-
You have such slow run even after the second run? And on your dev machine?
I get like 8s on v1 and 10s on v2.
This is expected because nodejs needs to always recompile all sources.
We provide flag--keepAlive
to speed things up.
-
Above test was using standalone jsreport.exe. I get timeout error on server when the application try to render PDF using .net SDK 'RenderAsync()'. I believe it is creating
new Process ()
on every RenderAsync request, I could be wrong. If it createnew Process()
on every request, how does--keepAlive
helps? Also, how to set--keepAlive
in the .net SDK? Also, is there any way to increase the default time-out 30sec?
-
If it create new Process() on every request, how does --keepAlive helps?
https://jsreport.net/learn/single-file-executable#improving-performance
However the keep alive is enabled in .net jsreport.Local by default.You may try this instead to speed it up.
https://jsreport.net/learn/dotnet-local#utility-or-web-serverAlso if you run for example in docker environment, it could be good idea to run jsreport as full separate microservice and use just
jsreport.Client
instead ofjsreport.Local
.Also, is there any way to increase the default time-out 30sec?
Update jsreport.Types@2.2.6 and
var rs = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => { cfg.Chrome = new ChromeConfiguration() { Timeout = 50000 }; return cfg; }) .AsUtility() .Create();
or use
jsreport.config.json
-
thanks for the suggestions, unfortunately I am still not meeting my client's accepted response time using JsReport solution. Near 100MB file just for utility tool and 30sec for generating a report is a 'no no' from my clients.
-
Hm... As I already described earlier, we have no way to decrease the size. The most of it is chrome.
Do you get a better response if you run the report in the playground or standalone jsreport server?
Any reason to update to v2 when the v1 was working fine for you?