Best investment for improving report speed?



  • Hi I have written an HTML app using the JS report html client to render PDF reports into a window on the screen. All works well apart from long reports that may return 10s of thousands of records which may take over a minute or 2 to render. Unfortunately the old FoxPro system that this replaces did the same thing in a fraction of the time and the users would like to see an improvement. I have looked at the database performance and can see that the records are delivered to the JS report server in a few seconds.

    Does anyone have any experience on what could be changed and how it affects speed. i.e. upping the hardware or modifying preprocessing scripts. At the moment JSreports runs on a 2 CPU amazon instance with 4 GB Ram



  • Please, run the report with debug button and share the output here.



  • Hi Jan... thanks for coming back to me... debug attached. Report used pdf utils for header footer and logo on first page....

    +0 Starting rendering request 1 (user: admin)
    +5 Rendering template { name: equipmentdetail-with-header-merge, recipe: chrome-pdf, engine: handlebars, preview: true }
    +6 Data item not defined for this template.
    +7 Resources not defined for this template.
    +9 Executing script extract-equipment using http-server strategy
    +267 equipment/?142&ds_id=142&asset=I&owner=P&location=Y&showdetail=true
    +268 undefined
    +8115 Base url not specified, skipping its injection.
    +8122 Replaced assets ["p1styles.css"]
    +8123 Rendering engine handlebars using http-server strategy
    +8439 Compiled template not found in the cache, compiling
    +8477 Pdf utils adding group field, value: "Equipment Detail Report | Filter: Location: F, Asset: F, Owner: P, Show Detail: true"
    +9619 Executing recipe chrome-pdf
    +9693 Starting child request to render pdf footer
    +9698 Starting rendering request 2 (user: admin)
    +9713 Rendering anonymous template { recipe: html, engine: handlebars }
    +9714 Data item not defined for this template.
    +9715 Resources not defined for this template.
    +9720 Base url not specified, skipping its injection.
    +9724 Rendering engine handlebars using http-server strategy
    +9884 Compiled template not found in the cache, compiling
    +9892 Executing recipe html
    +9893 Skipping storing report.
    +9894 Rendering request 2 finished in 197 ms
    +10032 Converting with chrome HeadlessChrome/79.0.3945.0 using dedicated-process strategy
    +10210 Page request: GET (document) file:///tmp/jsreport/autocleanup/e20ef0dd-99ce-45b3-88c9-8e25dd19cb4d-chrome-pdf.html
    +17639 Page request finished: GET (document) file:///tmp/jsreport/autocleanup/e20ef0dd-99ce-45b3-88c9-8e25dd19cb4d-chrome-pdf.html
    +18603 Running chrome with params {"printBackground":true,"landscape":false,"format":"A4","marginTop":"1.5cm","marginBottom":"1cm","scale":1,"width":"","height":"","marginLeft":"","marginRight":"","displayHeaderFooter":false,"footerTemplate":"...","margin":{"top":"1.5cm","right":"","bottom":"1cm","left":""}}
    +44159 Skipping pdf-utils password addition, the feature is disabled during preview requests
    +44159 pdf-utils is starting pdf processing
    +44491 pdf-utils detected 1 pdf operation(s) to process
    +48232 pdf-utils running pdf operation merge
    +48239 Starting rendering request 3 (user: admin)
    +48241 Rendering template { name: eq-header-port, recipe: chrome-pdf, engine: handlebars, preview: true }
    +48242 Inline data specified.
    +48242 Resources not defined for this template.
    +48243 Base url not specified, skipping its injection.
    +48248 Replaced assets ["Header-footer.css","p1logo.png"]
    +48249 Rendering engine handlebars using http-server strategy
    +48464 Compiled template not found in the cache, compiling
    +48503 Executing recipe chrome-pdf
    +48622 Converting with chrome HeadlessChrome/79.0.3945.0 using dedicated-process strategy
    +48788 Page request: GET (document) file:///tmp/jsreport/autocleanup/1b8a2a9a-48ba-443b-8004-b0be63a465ce-chrome-pdf.html
    +48806 Page request finished: GET (document) file:///tmp/jsreport/autocleanup/1b8a2a9a-48ba-443b-8004-b0be63a465ce-chrome-pdf.html
    +48814 Page request: GET (image) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIoAAABxCAYAAAAK0ju+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWX...
    +48816 Page request finished: GET (image) 200 data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIoAAABxCAYAAAAK0ju+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWX...
    +48870 Running chrome with params {"printBackground":true,"landscape":false,"format":"A4","marginRight":"0.5cm","marginBottom":"","marginLeft":"0.5cm","width":"","height":"","margin":{"right":"0.5cm","bottom":"","left":"0.5cm"}}
    +49190 Skipping storing report.
    +49191 Rendering request 3 finished in 952 ms
    +50101 pdf-utils postproces start
    +52989 pdf-utils postproces end
    +53123 pdf-utils pdf processing was finished
    +53124 Skipping storing report.
    +53128 Rendering request 1 finished in 53128 ms



  • You can see the rendering spends most of the time inside chrome pdf rendering.

    +10032 Converting with chrome HeadlessChrome/79.0.3945.0 using dedicated-process strategy
    +10210 Page request: GET (document) file:///tmp/jsreport/autocleanup/e20ef0dd-99ce-45b3-88c9-8e25dd19cb4d-chrome-pdf.html
    +17639 Page request finished: GET (document) file:///tmp/jsreport/autocleanup/e20ef0dd-99ce-45b3-88c9-8e25dd19cb4d-chrome-pdf.html
    +18603 Running chrome with params {"printBackground":true,"landscape":false,"format":"A4","marginTop":"1.5cm","marginBottom":"1cm","scale":1,"width":"","height":"","marginLeft":"","marginRight":"","displayHeaderFooter":false,"footerTemplate":"...","margin":{"top":"1.5cm","right":"","bottom":"1cm","left":""}}
    +44159 Skipping pdf-utils password addition, the feature is disabled during preview requests
    

    This is something we can't optimize.
    Your only option is to try running with a faster CPU.
    Or try to simplify your CSS and JS, however, there are no docs or rule of thumb for this.
    You can only try to remove some code, measure perf, and step by step find what is the most consuming part of the code and then try to replace it.



  • Thank you Jan... given we are running js reports and a node Rest on an AWS server would you have any recommendation on size of instance that we should be using in production? I can definitely also see a lag between the time the node express data extract has all the data and when it is delivered to the report preprocessing script as a json array. I did also import the axios library into js reports to replace the request utility and that seems to work on large datasets without having to specifically code anything to stream data. Would you have any concerns on me doing that?



  • would you have any recommendation on size of instance that we should be using in production

    There is no way for me to predict this. Try some production load on your test sever and find the best fitting VM size.
    Be ready to scale up and down in the production.

    ? I can definitely also see a lag between the time the node express data extract has all the data and when it is delivered to the report preprocessing script as a json array. I did also import the axios library into js reports to replace the request utility and that seems to work on large datasets without having to specifically code anything to stream data. Would you have any concerns on me doing that?

    I'm afraid I don't get what you mean.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.