Node agent causing high memory usage

Node Agent causing high memory usage

We are using NewRelic to monitor our backgrounds jobs (with startBackgroundTransaction), and we were experiencing memory spikes in long processes.

await newrelic.startBackgroundTransaction("myJob", "job", async () => {
	const jobProcessor = require("path/to/myJob")
	return await jobProcessor.process(job)
})

We eventually found out that the agent seems to keep every TraceSegment in memory during the execution of the job.
Removing startBackgroundTransaction resolved the issue for us.

Is it the expected behavior? It does not seem to fit with very long processes that calls other background processes
Is there another workaround to this? Right now we would only remove startBackgroundTransaction for our known long processes but obviously it is not a long term solution.

  • APM Agent Version: 8.6.0
  • Run on Heroku
  • Main frameworks used: Parse, BullQueue

Hey there @francois3 ,

Thanks for reaching out to the New Relic Community! I think I might be able to shed some light on your situation through this doc HERE which should go into much greater detail on your issue.

If you have any questions or extra details to add in the meantime, then please don’t hesitate to reach out.

Cheers

Hi @eschwall ,

I did went through the documentation and I found nothing to help me with. Those 2 questions still remain:

Is it the expected behavior? It does not seem to fit with very long processes that calls other background processes
Is there another workaround to this? Right now we would only remove startBackgroundTransaction for our known long processes but obviously it is not a long term solution.