nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.44k stars 276 forks source link

rss keeps rising when heapTotal does not #4349

Closed hh768961735 closed 3 months ago

hh768961735 commented 4 months ago

Details

  1. Phenomenon: image image image

The picture above shows the memory status of the business's nodejs process, which has been running for about 5 days. RSS has been on the rise, from 4-5GB at the beginning, to nearly 12GB. HeapTotal fluctuates between 4-5GB, and external has been on an upward trend. , appears to be linear.

I collect these data based on the process.memoryUsage() method and collect and summarize the data in each worker thread, because this method can only count the data in the current thread.

  1. First describe our business situation: (1). About 300 fixed number of working threads are opened in the main process, and there are other working threads that need to be dynamically created. The number is uncertain. (2) There are scenarios for interactive use with C++ addons. Each of the above 300 and worker threads will require this C++ addons to interact with other modules in the business.

I have been trying to solve this problem in recent months. According to my understanding, heapTotal should be the memory of the js part. I am not sure whether it is a memory leak problem or a high memory usage problem. Our internal testers conduct modular testing for this problem ( Including the js part and C++ addons), we have not found anything that can cause memory leaks, or there are deficiencies in our testing. Is it related to the nodejs version?

The startup command line is: --max-old-space-size=6000 --inspect

I need everyone's help. This phenomenon should be abnormal. How should we continue to analyze it?

Node.js version

v16.20.1

Example code

No response

Operating system

Linux,

Scope

runtime

Module and version

Not applicable.

hh768961735 commented 4 months ago

1518 Jemalloc is currently configured on the server and is being run and observed.