带有 V8 的 Node.js 适合内存有限的设备吗? [英] Node.js with V8 suitable for limited memory device?

查看:42
本文介绍了带有 V8 的 Node.js 适合内存有限的设备吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道带有 V8 引擎的 node.js 是否适合部署在有限内存设备(例如 256mb)上并与其他进程并行运行.

Would like to know is node.js with V8 engine suitable to be deployed on limited memory device (e.g. 256mb) and running in parallel with other process.

我读到它会连接机器的资源.有没有办法限制V8引擎本身的内存和处理使用?

I read that it will hook up the resource of the machine. Is there way to limit the memory and processing usage of V8 engine itself?

推荐答案

256 MB 的内存足以运行 Node.js(例如在 Linux VPS 实例上),假设没有运行其他内存占用软件.Node 有 --max-stack-size 参数来限制内存使用.

256 MB is sufficient amount of RAM to run Node.js (e.g. on Linux VPS instance), assuming no other memory-hog software is run. Node has --max-stack-size argument for limiting the memory usage.

Node 的单线程事件服务器模型通常可以有效利用资源,但由于其 JIT 架构,V8 可能比解释/字节编译的实现(例如 PHP 或 CPython)使用更多的内存(同时提供卓越的性能).此外,为了利用多个 CPU 内核,必须运行多个 Node.js 进程(相对于内存共享线程),从而有效地增加了内存使用量,但这一限制也适用于其最流行的竞争对手.

Node's single-thread evented server model generally makes efficient use of resources, but V8 due its JIT architecture is likely to use somewhat more memory than interpreted/bytecompiled implementations, such as PHP or CPython (while offering superior performance). Also, to take advantage of multiple CPU cores, multiple Node.js processes must be run (versus memory-sharing threads), effectively multiplying the memory usage, but this limitation applies to its most popular competitors as well.

与其他进程并行运行"连接机器资源"方面,运行Node.js进程没有什么特别之处(除了并不少见的多核问题);它的行为类似于任何用户态程序.您可以在操作系统级别对 Node.js 进程进行低优先级处理(例如使用 nice),但根据您的设备/应用程序,I/O 可能更成为一个问题.

In the respect of "running in parallel with other process" or "hooking up the resource of the machine", there is nothing special about running Node.js process (except the not uncommon multicore issue); it behaves similarly to any userland program. You can low-prioritize the Node.js process in OS level (e.g. with nice), but depending on your device/application, I/O can be potentially more an issue.

纯粹从技术/效率的角度来看,当需要真正的多处理支持和高并发性时,Erlang 可能是高级语言的更理想选择.

Purely from technical/effectiviness perspective, Erlang is probably more ideal choice for a high-level language when true multiprocessing support and high concurrency is required.

这篇关于带有 V8 的 Node.js 适合内存有限的设备吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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