help icon indicating copy to clipboard operation
help copied to clipboard

How to investigate RSS memory leak?

Open mwilniewiec opened this issue 1 year ago • 5 comments

Details

I have a problem with one of my microservices that its RSS memory is rising and I don't know what should be a proper way of finding the real problem. I already analyzed heapdumps and nothing can be found as I can see that heap is pretty stable.

process.memoryUsage() is currently showing:

external: 40866815,   (38.97 MB)
heapTotal: 135319552, (129.05 MB)
heapUsed: 114264216,  (108.97 MB)
rss: 1641189376,      (1565.16 MB)

It's a docker running inside of a k8s pod doing quite a lot of things.

  • it's a client of RabbitMQ (using amqplib) processing lots of messages
  • using prostgres with typeorm
  • using redis
  • making GRPC calls to other services
  • decompressing data using zlib.inflateSync
  • lots of other stuff

Heap: image

RSS: image

In the charts you can see that there are 2 instances of this microservice and both have exactly the same growth in RSS and exactly the same Heap.

Is there any way that I could analyse the other 1.3 GB of RSS memory which is not in the Heap ?

Node.js version

12.14.1

Example code

No response

Operating system

Alpine Linux v3.11 (in a Docker)

Scope

runtime

Module and version

Not applicable.

mwilniewiec avatar Apr 05 '23 10:04 mwilniewiec