Is there a way to share memory among workers/threads/something in Node.JS? Is there a way to share memory among workers/threads/something in Node.JS? multithreading multithreading

Is there a way to share memory among workers/threads/something in Node.JS?


I tried write a C/C++ binding of shared memory access from nodejs. https://github.com/supipd/node-shm

Still work in progress (but working for me), maybe usefull, if bug or suggestion, inform me.


building with waf is old style (node 0.6 and below), new build is with gyp.

You should look at node cluster (http://nodejs.org/api/cluster.html). Not clear this is going to help you without having more details, but this runs multiple node processes on the same machine using fork.


Actually Node does support spawning processes. I'm not sure how close Node's fork is to real fork, but you can try it:

http://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options

By the way: it is not true that Node is unsuited for that. It is as suited as any other language/web server. You can always fire multiple instances of your server on different ports and put a proxy in front.

If you need more memory - add more memory. :) It is as simple as that. Also you should think about putting all of that data on a dedicated in-memory database like Redis or Memcached ( or even Couchbase if you need complex queries ). You won't have to worry about duplicating that data any more.