Memory usage issue in JsReport



  • Hi, I have one application pod containing the Jsreport service, and we use that to generate reports through batch process using some other tool. We're having a memory issue for JsReport pod when we run one batch process, it's taking up to 1 GB of memory, but at the start or when we restart the pod, it takes up to 500 MB of memory. When the batch is finished (the work of Jsreport is done), that pod still shows the same memory usage up to 1 GB, not reducing memory as before. And after some time, we ran another batch, and this time it increased memory to 1 GB or more, but we didn't see any changes; the result was the same, no change occurred in memory usage.

    I need a solution ASAP for how to control and limit the memory usage of Js Report.



  • Hi,

    nodejs uses a garbage collector and it doesn't release memory just after jsreport stops using it. If there is plenty of free memory it often holds it for a long. If you set a memory limit to the pod to some 1.5GB, are you able to run multiple batches one after the other without error? When you limit the memory the nodejs will run garbage collection more eagerly.

    The second aspect is that jsreport lazy load's code and caches. If you start jsreport, not everything is already in memory, recipes are typically lazy loaded when first used. However, this shouldn't be more than 500mb typically.

    Are you using jsreport 3.11.0 ? There are some improvements.



  • We have .NET Application when we run batch simultaneously one bye one, memory usage of pod getting increases again, we run six batch process to check performance. Here are the status of memory usage in docker : -
    (Generating only 600 Jsreports only, not huge data)

    before running batch(or after restarted pod) -> up to 500mb

    1st batch -> 800mb+ (after finished)

    2nd batch -> 1.3gb (after finished)

    3rd batch -> 1.4gb (after finished)

    4th batch -> 1.4gb (after finished)

    5th batch -> 1.2gb (after finished)

    6th batch -> 1.6gb (after finished)

    Yes using latest version for Jsreport.

    And also we limit the memory 1GB for Jsreport service pod. Pod getting evicted and restarted many times. this is our issue.



  • As I said, increased memory is common for garbage collected app. You would need to trigger garbage collection to give these measurements meaning.

    We would analyze this, but we would need to know what docker image with config you use and what templates you have. Then we could be able to replicate this and provide you better insight what is happening.


Log in to reply
 

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