How can make report faster during rendering?

  • Hi, I have a virtual server running jsreport with a lot of Memory and 16 core CPUs and
    more than 10 reports on it and everything works fine, except that 90% of users (that are about 30-40 users) working with only one report at the time. As I monitored, data retrieving and manipulating for report take about 100 ms but rendering takes between 10 to 16 seconds, other hand I see that only 3 or 4 core CPUs use proccessing time and others are idle. I think this is depends on "tasks.numberOfWorkers" config, that in my configuration file is 4. Now the question so I understand is can with exceeding this parameter make all CPUs active in the rendering process?


  • Hi, thank you for reaching us at the forum.

    node.js evaluating the templating engines as well as the phantomjs rendering pdf are only single threaded and use always only single CPU.
    To get the best out of your VM, you should adapt the jsreport config and let it spin multiple phantomjs as well as node workers.

    I would start with this (remove the comments before pasting it)

    "phantom": {    
        // reuse phantomjs process instances over the multiple pdf rendering requests (remove startup time penalty) 
        "strategy": "phantom-server",
       // use 8 phantomjs instances for the pdf rendering  (8 pdf rendering can run simultaneously)
        "numberOfWorkers": 8
    "tasks": {       
         // reuse node process instances over the multiple templating engine evaluation requests (remove startup time penalty) 
        "strategy": "http-server",
        // use 12 node.exe instances for the templating engines (the templating engines evaluation is then load balanced over 12 processes)
        "numberOfWorkers": 12

    Hope this helps for the start. Let us know if you have further information and results so we can help.

  • Thanks a lot Jan for your reply. I will be make the changes and then monitor it, that can find only this issue is my problem

  • Hi alishokoie,

    did the config change help? I am looking into the same issue.

  • Hi Oshri,
    unfortunately not, I think my problem needs to deep considerations, and temporary I've disabled some reports, because could not wait for a suitable solution.
    But I must come back to the issue as soon as possible and I share the results.

  • hi guys,
    i tried this, and it doesnt work.
    what i tried as well, was clustering the http requests in nodejs, but no luck.

    i noticed that on the first window, the jsreport engine contacts localhost for loading, while the other window is "waiting for cache", and after the first window loads, it then begins loading.

    any guidance please?

    PS: i got a download button with its route to nodejs's jsreport. i am opening multiple screens of the same view and testing.

  • @anthony-elhaddad Please try to gather more information and provide it to us. Like output logs. It include timing information so we can see where is the rendering stuck. Perhaps create a new topic for it.

  • i have a download button on my Angular project, on click it goes to the server at http://localhost:3000/test/printPolicy , and will get me the pdf content to download it from Angular(Client side). The report is a heavy one and needs around 9000ms to be downloaded.

    i added another button but referencing the same method that calls the server at http://localhost:3000/test/printPolicy. (should get me the same report)

    On testing: i have clicked the button1 then button2 and my result was: I waited 9000ms to get the first report and another 9000ms to get the second report.
    My question is here: What can I do to make them load simultaneously, not having to wait another 9000ms to get the second one.

    EDIT -------
    Fixed, To test it, open a new browser, dont use the incognito mode of the same browser.

Log in to reply

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