简体   繁体   English

Node.js-了解和限制内存使用

[英]Node.js - Understanding and Limiting Memory Usage

I am in the process of running multiple Node applications on a single instance. 我正在单个实例上运行多个Node应用程序。 One of the elements I am concerned about is memory usage. 我关注的元素之一是内存使用率。 Is there a minimum amount of physical memory required by a simple Node.js express service? 简单的Node.js Express服务是否需要最少的物理内存? Is there a way I can set an upper bound on the memory usage to prevent one of my node applications from affecting the others use of physical memory? 有没有一种方法可以设置内存使用率的上限,以防止我的一个节点应用程序影响其他物理内存的使用?

It might be worth your while to put your node processes on docker instance. 将节点进程放在docker实例上可能是值得的。 Might just start with the default node docker image and then add your source code and boot up the scripts in the Dockerfile. 可能仅从默认节点docker映像开始 ,然后添加您的源代码并启动Dockerfile中的脚本。

Docker allows you to limit the memory of each Docker instance, and many Docker instances can run on a single machine (or Virtual Machine). Docker允许您限制每个Docker实例的内存,并且许多Docker实例可以在单个计算机(或虚拟机)上运行。 I think this approach might be your best bet. 我认为这种方法可能是您最好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM