# Node JS 18

This page describes the Optimization Pack for the component type NodeJS.

## Metrics

| Metric                                      | Unit     | Description                                                                                                                                    |
| ------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| cpu\_used                                   | CPUs     | The total amount of CPUs used                                                                                                                  |
| cpu\_util                                   | percent  | The average CPU utilization % across all the CPUs (i.e., how much time on average the CPUs are busy doing work)                                |
| memory\_used                                | bytes    | The total amount of memory used                                                                                                                |
| memory\_util                                | percent  | The average memory utilization %                                                                                                               |
| nodejs\_gc\_heap\_used                      | bytes    | GC heap used                                                                                                                                   |
| nodejs\_rss                                 | bytes    | Process Resident Set Size (RSS)                                                                                                                |
| nodejs\_v8\_heap\_total                     | bytes    | V8 heap total                                                                                                                                  |
| nodejs\_v8\_heap\_used                      | bytes    | V8 heap used                                                                                                                                   |
| nodejs\_number\_active\_threads             | threads  | Number of active threads                                                                                                                       |
| nodejs\_suspension\_time                    | percent  | Suspension time %                                                                                                                              |
| nodejs\_active\_handles                     | handles  | Number of active libuv handles grouped by handle type. Every handle type is C++ class name                                                     |
| nodejs\_active\_handles\_total              | handles  | Total number of active handles                                                                                                                 |
| nodejs\_active\_requests                    | requests | Number of active libuv requests grouped by request type. Every request type is C++ class name                                                  |
| nodejs\_active\_requests\_total             | requests | Total number of active requests                                                                                                                |
| nodejs\_eventloop\_lag\_max\_seconds        | seconds  | The maximum recorded event loop delay                                                                                                          |
| nodejs\_eventloop\_lag\_mean\_seconds       | seconds  | The mean of the recorded event loop delays                                                                                                     |
| nodejs\_eventloop\_lag\_min\_seconds        | seconds  | The minimum recorded event loop delay                                                                                                          |
| nodejs\_eventloop\_lag\_p50\_seconds        | seconds  | The 50th percentile of the recorded event loop delays                                                                                          |
| nodejs\_eventloop\_lag\_p90\_seconds        | seconds  | The 90th percentile of the recorded event loop delays                                                                                          |
| nodejs\_eventloop\_lag\_p99\_seconds        | seconds  | The 99th percentile of the recorded event loop delays                                                                                          |
| nodejs\_eventloop\_lag\_seconds             | seconds  | Lag of event loop in seconds                                                                                                                   |
| nodejs\_external\_memory\_bytes             | bytes    | NodeJS external memory size in bytes                                                                                                           |
| nodejs\_gc\_duration\_seconds\_bucket       | seconds  | The total count of observations for a bucket in the histogram. Garbage collection duration by kind, one of major, minor, incremental or weakcb |
| nodejs\_gc\_duration\_seconds\_count        | seconds  | The total number of observations for Garbage collection duration by kind, one of major, minor, incremental or weakcb                           |
| nodejs\_gc\_duration\_seconds\_sum          | seconds  | The total sum of observations for Garbage collection duration by kind, one of major, minor, incremental or weakcb                              |
| nodejs\_heap\_size\_total\_bytes            | bytes    | Process heap size from NodeJS in bytes                                                                                                         |
| nodejs\_heap\_size\_used\_bytes             | bytes    | Process heap size used from NodeJS in bytes                                                                                                    |
| nodejs\_heap\_space\_size\_available\_bytes | bytes    | Process heap size available from NodeJS in bytes                                                                                               |
| nodejs\_heap\_space\_size\_total\_bytes     | bytes    | Process heap space size total from NodeJS in bytes                                                                                             |
| nodejs\_heap\_space\_size\_used\_bytes      | bytes    | Process heap space size used from NodeJS in bytes                                                                                              |
| process\_cpu\_seconds\_total                | seconds  | Total user and system CPU time spent in seconds                                                                                                |
| process\_cpu\_system\_seconds\_total        | seconds  | Total system CPU time spent in seconds                                                                                                         |
| process\_cpu\_user\_seconds\_total          | seconds  | Total user CPU time spent in seconds                                                                                                           |
| process\_heap\_bytes                        | bytes    | Process heap size in bytes                                                                                                                     |
| process\_max\_fds                           | fds      | Maximum number of open file descriptors                                                                                                        |
| process\_open\_fds                          | fds      | Number of open file descriptors                                                                                                                |
| process\_resident\_memory\_bytes            | bytes    | Resident memory size in bytes                                                                                                                  |
| process\_virtual\_memory\_bytes             | bytes    | Virtual memory size in bytes                                                                                                                   |

## Parameters

| Parameter                               | Type        | Unit      | Default Value                           | Domain                                                                                                      | restart | Description                                                                                                                                                               |
| --------------------------------------- | ----------- | --------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| v8\_allocation\_size\_pretenuring       | categorical |           | `--allocation-site-pretenuring`         | `--allocation-site-pretenuring`, `--no-allocation-site-pretenuring`                                         | yes     | Pretenure with allocation sites                                                                                                                                           |
| v8\_min\_semi\_space\_size              | integer     | megabytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Min size of a semi-space (in MBytes), the new space consists of two semi-spaces                                                                                           |
| v8\_max\_semi\_space\_size              | integer     | megabytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Max size of a semi-space (in MBytes), the new space consists of two semi-spaces. This parameter is equivalent to v8\_max\_semi\_space\_size\_ordinal.                     |
| v8\_max\_semi\_space\_size\_ordinal     | ordinal     | megabytes | `16`                                    | `2`, `4`, `6`, `8`, `16`, `32`, `64`, `128`, `256`, `512`, `1024`, `2048`, `4096`, `8192`, `16384`, `32768` | yes     | Max size of a semi-space (in MBytes), the new space consists of two semi-spaces. This parameter is equivalent to v8\_max\_semi\_space\_size but forces power of 2 values. |
| v8\_semi\_space\_grouth\_factor         | integer     |           | `2`                                     | `0` → `100`                                                                                                 | yes     | Factor by which to grow the new space                                                                                                                                     |
| v8\_max\_old\_space\_size               | integer     | megabytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Max size of the old space (in Mbytes)                                                                                                                                     |
| v8\_max\_heap\_size                     | integer     | megabytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Max size of the heap (in Mbytes) both max\_semi\_space\_size and max\_old\_space\_size take precedence. All three flags cannot be specified at the same time.             |
| v8\_initial\_heap\_size                 | integer     | megabytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Initial size of the heap (in Mbytes)                                                                                                                                      |
| v8\_initial\_old\_space\_size           | integer     | megabytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Initial old space size (in Mbytes)                                                                                                                                        |
| v8\_parallel\_scavenge                  | categorical |           | `--parallel-scavenge`                   | `--parallel-scavenge`, `--no-parallel-scavenge`                                                             | yes     | Parallel scavenge                                                                                                                                                         |
| v8\_scavenge\_task\_trigger             | integer     |           | `80`                                    | `1` → `100`                                                                                                 | yes     | Scavenge task trigger in percent of the current heap limit                                                                                                                |
| v8\_scavenge\_separate\_stack\_scanning | categorical |           | `--no-scavenge-separate-stack-scanning` | `--scavenge-separate-stack-scanning`, `--no-scavenge-separate-stack-scanning`                               | yes     | Use a separate phase for stack scanning in scavenge                                                                                                                       |
| v8\_concurrent\_marking                 | categorical |           | `--concurrent-marking`                  | `--concurrent-marking`, `--no-concurrent-marking`                                                           | yes     | Use concurrent marking                                                                                                                                                    |
| v8\_parallel\_marking                   | categorical |           | `--parallel-marking`                    | `--parallel-marking`, `--no-parallel-marking`                                                               | yes     | Use parallel marking in atomic pause                                                                                                                                      |
| v8\_concurrent\_sweeping                | categorical |           | `--concurrent-sweeping`                 | `--concurrent-sweeping`, `--no-concurrent-sweeping`                                                         | yes     | Use concurrent sweeping                                                                                                                                                   |
| v8\_heap\_growing\_percent              | integer     |           | `0`                                     | `0` → `99`                                                                                                  | yes     | Specifies heap growing factor as (1 + heap\_growing\_percent/100)                                                                                                         |
| v8\_os\_page\_size                      | integer     | kilobytes | `0`                                     | `0` → `1048576`                                                                                             | yes     | Override OS page size (in KBytes)                                                                                                                                         |
| v8\_stack\_size                         | integer     | kilobytes | `984`                                   | `16` → `1048576`                                                                                            | yes     | Default size of stack region v8 is allowed to use (in kBytes)                                                                                                             |
| v8\_single\_threaded                    | categorical |           | `--no-single-threaded`                  | `--single-threaded`, `--no-single-threaded`                                                                 | yes     | Disable the use of background tasks                                                                                                                                       |
| v8\_single\_threaded\_gc                | categorical |           | `--no-single-threaded-gc`               | `--single-threaded-gc`, `--no-single-threaded-gc`                                                           | yes     | Disable the use of background gc tasks                                                                                                                                    |
