For communicating directly between processes in nodejs, I have not found/known any solution so far.
Btw, I'm not sure about "duplicating transfer data" as you mentioned, initially I think data packet just has been forwarded literally, no duplication (Am I wrong here:-??). And I think we can use redis pub/sub to communicate between processes (with Redis server as bridge). Actually in my application now I'm using redis pubsub to communicate between servers, but in fact you can think each server is a process, so this is the solution for communicating between processes. I use redis pubsub, socket.io with RedisStore to run the app on multi servers (external duplication), each server is multi core (internal duplication), everything is quite good now. On Mon, Sep 10, 2012 at 5:27 PM, Yi Tan <yi2...@gmail.com> wrote: > Hi hd nguyen, > > Thank you for the reply. > > Yes, I have tried cluster-worker message sending. There are 3 issues block > me from using that built-in mechanism: > > 1. the app I'm working on is talking in raw buffer. but when sending > buffer in node's built-in cluster, it actually transmit the SlowBuffer > instance, which is 8k in fixed length. That means even sending 1 byte, the > actually data transition needs be 16k (8k workerA->master, 8k master-> > workerB). That is a huge waste. > > 2. the mechanism I'm looking for is a peer-to-peer implementation. the > built-in cluster is a server-route implementation, which doubles the data > cost of communication, another waste. > > 3. I can't find an easy way to pipe a stream to a process. Am I missing > something? > > Thank you, > > ty > > > > 2012/9/10 hd nguyen <nguyenhd2...@gmail.com> > >> Did you take a look at cluster api? >> >> http://nodejs.org/api/cluster.html#cluster_worker_send_message_sendhandle >> >> I think we can send msg to master process, and from master process, >> broadcast msg to other workers. >> >> More discussion can be referred in this link: >> http://stackoverflow.com/questions/8534462/nodejscluster-how-to-send-data-from-master-to-to-all-or-single-child-workers >> >> >> On Mon, Sep 10, 2012 at 3:44 PM, Yi Tan <yi2...@gmail.com> wrote: >> >>> Hi node mates: >>> >>> I'm looking for your advice about how to design and implement an >>> mechanism for real-time socket-based cross clustered-process data >>> communication and computation. >>> >>> [The server layout] >>> >>> clientA <--tcp socket--> node service A <--> DataModelA <--> unique >>> radis data store >>> >>> clientB <--tcp socket--> node service B <--> DataModelB <--> unique >>> radis data store >>> >>> * node service A and B are cluster on the same server >>> * 1 data model represent 1 client at the run time >>> * both node service A and B talk to the same redis data store >>> >>> [The function request] >>> >>> I need to implement a mechanism, in which: >>> 1. clients in difference processes can communication with each other >>> efficiently. >>> 2. there need to be a centralized place for data computation base on >>> data models represents difference clients >>> >>> the logic looks like the following diagram: >>> >>> clientA <--tcp socket--> node service A >>> | >>> socket pipe >>> | >>> v >>> clientB <--tcp socket--> node service B <--> DataModelA and B <--> >>> unique radis data store >>> >>> Do you know what is the best way to do this, or is there something >>> already been built >>> >>> Many thanks, >>> >>> ty >>> >>> >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to nodejs@googlegroups.com >>> To unsubscribe from this group, send email to >>> nodejs+unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >>> >> >> >> >> -- >> Nguyen Hai Duy >> Mobile : 0914 72 1900 >> Yahoo: nguyenhd_lucky >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Nguyen Hai Duy Mobile : 0914 72 1900 Yahoo: nguyenhd_lucky -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en