Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js with V8 suitable for limited memory device?

Tags:

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.

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?

like image 569
TonyTakeshi Avatar asked Mar 08 '12 06:03

TonyTakeshi


People also ask

How much RAM is required for NodeJS?

Recommended minimum specsAt least 2GB of RAM.

Does Node still use V8?

Node. js is just a runtime environment that supports the execution of a program. V8 is at the core of Node.

How do I increase the memory limit in NodeJS?

If you want to increase the max memory for Node you can use --max_old_space_size option. You should set this with NODE_OPTIONS environment variable.

What version of V8 does Node use?

Node 6 uses V8 release 5 as its JavaScript engine. (The first few point releases of Node 8 also use V8 release 5, but they use a newer V8 point release than Node 6 did.)


2 Answers

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'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.

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.

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.

like image 167
jholster Avatar answered Oct 05 '22 00:10

jholster


64MB of RAM is sufficient for V8 and Node.js

See "Compiling Node.js for Arduino YÚN" and also "installing Node.js on Arduino YÚN".

Arduino YÚN runs linux with 64MB of RAM.

like image 42
Matteo T. Avatar answered Oct 05 '22 01:10

Matteo T.