Monday, 10 April 2017

NodeJS, PM2, GC, Grafana - better understanding

I would like to unterstand the GC Process a little bit better in Nodejs/V8.

Could you provide some information for the following questions:

  • When GC is triggered, does this block the event loop of node js ?
  • Is GC running in it's own process or is just a submethod of the event-loop ?

  • When spawning nodejs process via Pm2 (clustered mode) does the instance really have it's own process or is the GC shared between the instances ?

  • For Logging Purposes I am using Grafana (https://github.com/RuntimeTools/appmetrics-statsd), can someone explain the differences \ more details about these gauges:

    gc.size the size of the JavaScript heap in bytes.

    gc.used the amount of memory used on the JavaScript heap in bytes.

  • Are there any scenarios where GC is not freeing memory (gc.used) in relation with stress tests ?

The questions are related to an issue that I am currently facing. The used memory of GC is rising and doesn't release any memory (classical memory leak). The problem is that it only appears when we a lot of requests.

I played around with max-old-space-size to avoid pm2 restarts, but it looks like that GC is not freeing up anymore and the whole application is getting really slow...

Any ideas ?



via Christoph Ott

No comments:

Post a Comment