Node memory optimization strategy

  node.js, question

Do you have any research on node’s memory management?

I am currently studying node chat room and have already made a load balancing plan.
The general framework is tengine session sticky plus pm2 multi-process management. The load condition is still ideal for 2 4C8G Alibaba Cloud, each with 4 processes. If the socket per process is more than 1000, or the load maintained at about 0.3 is further optimized, it should be even higher.

However, there is still a problem of node’s memory occupation, and I find that every time node receives socket connection, the memory cannot be released in time. even if socket is disconnected, the memory is occupied all the time. it probably has nothing to do with the code quality after testing. the rest may be node’s own memory management optimization problem. I am not a strong point in this aspect, but I have just come into contact with node.

I hope Daniel can provide node’s memory release plan.

There’s nothing wrong with not releasing the memory, it’s not good to leak it.