NodeJS:为什么pm2列表显示内存不断增加? [英] NodeJS: Why pm2 list shows memory keeps on increasing?

查看:1040
本文介绍了NodeJS:为什么pm2列表显示内存不断增加?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有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.

我的问题:


  1. 为什么我的记忆力会继续增加?

  2. 它会下降吗?

  3. 是否由于setInterval继续记录进程使用情况而发生这种情况?

  4. 这是否由于控制台记录而发生每个请求和响应?

  5. 我的Redis数据库保持打开状态直到我的服务器崩溃,这导致了这个?

  6. 我是否需要使用进程管理器比如新遗物或强循环来识别这个?

  7. 那么这个记忆会持续增加多久,在某些时候它必须停止(我想知道那个点是什么?)

  8. 我使用池化概念使用MSSQL事务的sequelize?汇集会产生这个吗?

  1. Why my Memory Keeps on Increasing?
  2. Will it get down?
  3. Is this occurs due to setInterval keeps on logging the process usage?
  4. Is this occurs due to console logging of every request and response?
  5. My Redis Database is kept open till my server crashes, it this causes this ?
  6. Do i need use process mananger like new relic or strong loop to identify this?
  7. So how long this memory will keep on increasing, at some point it must stop (i want to know which point is that?)
  8. 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.

推荐答案



  1. 为什么我的记忆力不断增加?


你有内存泄漏



  1. 它会下降吗?


有时GC开始并清理一些东西(没有泄漏)

Sometimes GC kicks in and cleans up some things (that are not leaking)



  1. 这是因为setInterval继续记录进程使用情况吗?


通常不是,但是w / o看到代码我不能肯定地说这个

Usually not, but w/o seeing the code I can't say this for sure



  1. 这是否发生由于每个请求和响应的控制台记录?


通常不是,但没有看到代码我不能肯定地说这个

Usually not, but w/o seeing the code I can't say this for sure



  1. 我的Redis数据库保持打开状态直到我的服务器崩溃es,这会导致这个吗?


应该不是问题。



  1. 我是否需要使用流程管理员(如新文物或强力环)来识别这个?


这是一种方法......但也有其他方式。

It is one way to do it ... but there are also others.



  1. 那么这段内存会持续增加多久,在某些时候它必须停止(我想知道那是什么意思? )


取决于服务器设置。 RAM多少+正在运行的等等。

Depends on the server setup. How much RAM + what else is running etc.



  1. 我正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆