NodeJS:为什么pm2列表显示内存不断增加? [英] NodeJS: Why pm2 list shows memory keeps on increasing?
问题描述
我正在使用带有NodeJS的HAPI.JS框架并创建了一个代理。认为代理意味着我只是在redis中维护会话。除此之外,我没有在代码中做任何事情。可能是唯一的事情是我使用setInterval来记录我的process.memoryUsage()每3分钟。
I am using HAPI.JS framework with NodeJS and created a proxy. Think that proxy means i am just maintaining session in redis. Other than that i am not doing anything in the code. May be only thing is i am using setInterval to log my process.memoryUsage() for every 3 mintues.
我的问题:
- 为什么我的记忆力会继续增加?
- 它会下降吗?
- 是否由于setInterval继续记录进程使用情况而发生这种情况?
- 这是否由于控制台记录而发生每个请求和响应?
- 我的Redis数据库保持打开状态直到我的服务器崩溃,这导致了这个?
- 我是否需要使用进程管理器比如新遗物或强循环来识别这个?
- 那么这个记忆会持续增加多久,在某些时候它必须停止(我想知道那个点是什么?)
- 我使用池化概念使用MSSQL事务的sequelize?汇集会产生这个吗?
- Why my Memory Keeps on Increasing?
- Will it get down?
- Is this occurs due to setInterval keeps on logging the process usage?
- Is this occurs due to console logging of every request and response?
- My Redis Database is kept open till my server crashes, it this causes this ?
- Do i need use process mananger like new relic or strong loop to identify this?
- So how long this memory will keep on increasing, at some point it must stop (i want to know which point is that?)
- I am using sequelize of MSSQL transaction using pooling concept? Does pooling makes this?
P.S我是节点JS的新手。
P.S I am new to node JS.
推荐答案
- 为什么我的记忆力不断增加?
你有内存泄漏
- 它会下降吗?
有时GC开始并清理一些东西(没有泄漏)
Sometimes GC kicks in and cleans up some things (that are not leaking)
- 这是因为setInterval继续记录进程使用情况吗?
通常不是,但是w / o看到代码我不能肯定地说这个
Usually not, but w/o seeing the code I can't say this for sure
- 这是否发生由于每个请求和响应的控制台记录?
通常不是,但没有看到代码我不能肯定地说这个
Usually not, but w/o seeing the code I can't say this for sure
- 我的Redis数据库保持打开状态直到我的服务器崩溃es,这会导致这个吗?
应该不是问题。
- 我是否需要使用流程管理员(如新文物或强力环)来识别这个?
这是一种方法......但也有其他方式。
It is one way to do it ... but there are also others.
- 那么这段内存会持续增加多久,在某些时候它必须停止(我想知道那是什么意思? )
取决于服务器设置。 RAM多少+正在运行的等等。
Depends on the server setup. How much RAM + what else is running etc.
- 我正在使用MSSQL的续集使用汇集概念的交易?汇集是否会产生这种效果?
通常没有,但没有看到我不能的代码肯定地说这个
Usually not, but w/o seeing the code I can't say this for sure
也许这篇文章可以帮助你找到泄漏:
https://www.nearform.com/blog/how-to-self-detect-a- memory-leak-in-node /
Maybe this post helps you find the leak:
https://www.nearform.com/blog/how-to-self-detect-a-memory-leak-in-node/
这篇关于NodeJS:为什么pm2列表显示内存不断增加?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!