8000 The features of the new version of node.js lead to an increase in the memory usage of the process · Issue #4228 · nodejs/help · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
The features of the new version of node.js lead to an increase in the memory usage of the process #4228
Open
@longG4

Description

@longG4

Details

Our business process has an upper limit baseline requirement,currently switching to a new version of node.js results in an increase in memory.node version v18.14.1 vs v14.21.3, the memory of the same sample code increased by about 10mb.
Why did this happen, and what factors?

Node.js version

18.14.1

Example code

The sample code indexTest.js as follows:

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
  console.info(`process info: rss ${(pro.rss / 1048576).toFixed(2)}MB heapTotal ${(pro.heapTotal / 1048576).toFixed(2)}MB heapUsed ${(pro.heapUsed / 1048576).toFixed(2)}MB external ${(pro.external / 1048576).toFixed(2)}MB`);
})

With express 4.18.1 we use the command: ./node indexTest.js
we can see memory performance information is as follows:
node v14.21.3

root@DESKTOP-TKJT03L:/opt/nodejsTest/node-14# ./node indexTest.js
Example app listening on port 3000
process info: rss 42.95MB heapTotal 10.33MB heapUsed 6.70MB external 1.47MB
process info: rss 42.95MB heapTotal 10.33MB heapUsed 6.71MB external 1.47MB
process info: rss 42.95MB heapTotal 10.33MB heapUsed 6.71MB external 1.47MB
process info: rss 42.95MB heapTotal 10.33MB heapUsed 6.71MB external 1.47MB
process info: rss 39.43MB heapTotal 6.70MB heapUsed 4.83MB external 1.39MB
process info: rss 39.43MB heapTotal 6.70MB heapUsed 4.85MB external 1.39MB
process info: rss 39.43MB heapTotal 6.70MB heapUsed 4.85MB external 1.39MB
process info: rss 39.43MB heapTotal 6.70MB heapUsed 4.86MB external 1.39MB

node v18.14.1

root@DESKTOP-TKJT03L:/opt/nodejsTest/node-14# ./node indexTest.js
Example app listening on port 3000
root@DESKTOP-TKJT03L:/opt/nodejsTest/node-18# ./node indexTest.js
Example app listening on port 3000
process info: rss 54.73MB heapTotal 11.84MB heapUsed 8.70MB external 0.75MB
process info: rss 54.73MB heapTotal 11.84MB heapUsed 8.71MB external 0.75MB
process info: rss 54.73MB heapTotal 11.84MB heapUsed 8.71MB external 0.75MB
process info: rss 54.73MB heapTotal 11.84MB heapUsed 8.71MB external 0.75MB
process info: rss 51.95MB heapTotal 9.09MB heapUsed 7.17MB external 0.72MB
process info: rss 51.95MB heapTotal 9.09MB heapUsed 7.37MB external 0.72MB
process info: rss 51.95MB heapTotal 9.09MB heapUsed 7.43MB external 0.72MB
process info: rss 51.95MB heapTotal 9.09MB heapUsed 7.44MB external 0.72MB
process info: rss 51.95MB heapTotal 9.09MB heapUsed 7.44MB external 0.72MB

Operating system

Ubuntu 18.04.5
kernel version is 5.10.16.3

Scope

other

Module and version

Not applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0