'memory usage metrics

I'm trying to set up a monitoring for my nodejs application. I'm having some confusion on what info represents the memory usage for the application

My instance has 2gb ram, and there is only 1 nodejs application running. Here are info I gathered from the instance and application:

/proc/pid/status

VmSize:     11395203 kB
VmRSS:       60919 kB
> process.memoryUsage()
{
  rss: 39473152,
  heapTotal: 5939200,
  heapUsed: 4963608,
  external: 911124,
  arrayBuffers: 10452
}

I have the following questions

  1. Why VmRSS does not match rss? Which one reflects how much memory assigned to the node process?
  2. In which condition, out of memory is about to occur? heapUsed is approaching to heapTotal or VmRSS is approaching to 2gb?
  3. From data above, how do I know how much memory left for the nodejs application to use?


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source