More on slow performance of JsReports 2.2



  • Hello,
    I read about the --keepAlive option for the command line but I am looking for an option at nodejs level. I have small application with no cloud setup and IIS server is like a firewall or proxy and I have not registered my jsreport application under it.

    I don't know if my jsReport instance is sleeping so how to find out about it is my first Question?
    I don't think the slowness is just for the first time, it takes a single page report around 2s and 3-page report around 4s. This is how I am starting jsReport, Pl suggest how to add --keepAlive option.

    let startJsreport = (server, app) => {
        /// define the jsreport middleware
        let jsreport = require('jsreport')({
            extensions: {
                express: { app: reportingApp, server: server },
            },
            appPath: "/reporting"
        });
    
        jsreport.init()
            .then(() => {
                console.log(`JSReport instance ${process.pid} started correctly.`);
            }).catch((e) => {
                console.error(e);
            });
    
        app.use('/reporting', accessMiddleware, (req, res, next) => {
            /// user should login to the server to access the admin console     
        },reportingApp);
    };
    

    Thank you,
    Rashmi



  • I want to add here that PDF-Utils are the cause of slowness. I had 2 pdf-merge operations - one to put sample watermark and other for the footer.
    Here are some stats: for 3 page document, 2 pdf-merge makes it 4 times longer and for 18 page document, its 10 times longer.

    For 3-page document with no PDFOperations - 588ms
    with sample watermark 1171ms
    with footer and sample 2443ms

    and for 18-page document with no PDF Operations 940ms
    with sample watermark 1754ms
    with footer and sample watermark 9780ms

    Maybe my footer file is not so efficient:

    </style>
    <footer>
      {{#with $pdf}} 
        {{#each pages}}    
            {{#if @first}} <!--write one time only -->
                <table width="83%" style="margin: 10px 67px;">
                   <tr>
                      <td align="center">
                             {{group.name}}{{group.more}}
                       </td>
                       {{#if_gt ../pages.length 1}} <!-- page numbers if more than 1 page-->
                        <td align="right" width="5%">
                          {{../pageNumber}}/{{../pages.length}} 
                       </td>
                       {{/if_gt}}
                    </tr>
                </table>
            {{/if}}    
        {{/each}}
      {{/with}}
    </footer>
    
    


  • The keepAlive is just feature of the single executable.
    It won't help when you have normal node.js based setup.

    The pdf utils is not efficient if you use "merge for every page" at this moment.
    We have some tasks in the queue to improve it. We know how, just didn't get to it yet.
    I believe we will have it ready during the next two months.



  • Thanks Jan. I will wait for the update.


Log in to reply
 

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