Node.js Memory Usage Test

Heap memory is  a large pool of memory (typically per process) from which the running program can request chunks. When the Node.js application is started, heap memory is created and any object in the heap can be shared between threads as long as the application is running. if the heap memory utilization increases rapidly, then, sufficient memory resources will not be available for all the Node.js instances which in turn will affect the performance of the Node.js applications. Also, administrators should keep track on the type of objects/space that are mostly contributing to memory contention. The Node.js Memory Usage test helps administrators identify memory bottlenecks.

This test periodically monitors the memory usage of the target Node.js application server, checks whether adequate heap memory is available to the Node.js application server, and if not, promptly alerts users to the same. In the process, the test also reveals the amount of heap memory space that is used to store large objects, new objects, maps etc. This way, potential memory contention caused due to excessive heap memory utilization by the exact type of objects is brought to administrator's attention.

Target of the test : A Node.js V8 Engine

Agent deploying the test : An internal agent

Outputs of the test : One set of results for each instance of the target Node.js server being monitored

Configurable parameters for the test
Parameter Description

Test Period

How often should the test be executed.

Host

The IP address of the host for which this test is to be configured.

Port

The port at which the target Host listens to. By default this is 3000.

DD Frequency

Refers to the frequency with which detailed diagnosis measures are to be generated for this test. The default is 1:1. This indicates that, by default, detailed measures will be generated every time this test runs, and also every time the test detects a problem. You can modify this frequency, if you so desire. Also, if you intend to disable the detailed diagnosis capability for this test, you can do so by specifying none against DD frequency.

Detailed Diagnosis

To make diagnosis more efficient and accurate, the eG Enterprise embeds an optional detailed diagnostic capability. With this capability, the eG agents can be configured to run detailed, more elaborate tests as and when specific problems are detected. To enable the detailed diagnosis capability of this test for a particular server, choose the On option. To disable the capability, click on the Off option.

The option to selectively enable/disable the detailed diagnosis capability will be available only if the following conditions are fulfilled:

  • The eG manager license should allow the detailed diagnosis capability
  • Both the normal and abnormal frequencies configured for the detailed diagnosis measures should not be 0.
Measurements made by the test
Measurement Description Measurement Unit Interpretation

Resident set size

Indicates the total memory allocated for execution of processes in this instance.

MB

This includes the Code Segment, Stack (local variables and pointers) and Heap (objects and closures).

Maximum heap

Indicates the maximum amount of memory allocated for heap on this instance.

MB

 

Heap used

Indicates the amount of heap memory used to execute the processes in this instance.

MB

 

Heap free

Indicates the amount of heap memory that is available for use in this instance.

MB

 

Heap used percentage

Indicates the percentage of heap memory that is already utilized in this instance.

Percent

Track if heap usage is approaching 90%. It is an indicator of a heap memory bottleneck. You may need to set a higher heap memory for your application, or investigate if there is memory inefficiency that is affecting it’s performance.

External size

Indicates the memory allocated for C++ objects bound to JavaScript objects managed by V8 Engine i.e., external strings and array buffers in this instance.

MB

 

Array buffers size

Indicates the memory allocated for array buffers in this instance.

MB

 

Number of worker processes

Indicates the number of worker processes executing on this instance.

Number

 

Read only space

Indicates the amount of heap memory allocated for storing strings that are immutable in this instance.

MB

 

New space

Indicates the amount of heap memory allocated for new objects.

MB

Each space is composed of a set of “pages”. A Page is a contiguous chunk of memory, allocated from the operating system with mmap (memory mapping). Pages are always 1 MB in size and 1 MB aligned, except in large-object-space, where they may be larger.

This space is relatively small and has a size of between 1MB and 8MB. Most of the objects are allocated here. garbage collection is rather faster in new space.

Old space

Indicates the amount of heap memory allocated to store objects that are promoted from the new space.

MB

Objects that survived the garbage collector in the new space alone are promoted into old space.

Code space

Indicates the amount of heap memory used to store assembly code generated by the JIT compiler in the Node.js V8 Engine of this instance.

MB

 

Map space

Indicates the amount of heap memory used to store Maps in this instance.

MB

The Map space, cell space and property cell space are used to simplify garbage collection.

Large object space

Indicates the amount of space allocated to store objects that are too big to fit in other space in this instance.

MB

Objects which are too big to fit in other spaces are created in this space. Each object has it’s own mmap‘ed region in memory.

Code large object space

Indicates the amount of heap memory used to store large assembly codes generated by the JIT compiler that are too big to fit in code object space of this instance.

MB

 

New large object space

Indicates the amount of heap memory used to store newer objects that are too big to fit in new object space of this instance.

MB

 

Process id

Indicates the Process ID of this instance.

Number