You might also want to think about having your components communicate via a database, file system, or message queue, as having tightly coupled components can cause devops headaches.
A looser coupling makes deployments easier, ops tasks more standardised (e.g. look in RabbitMQ manual, rather than dig through source code), allows for audit, transaction support, durability, logging, and allows specialised components to be written in the language that bets fits. But you know your problem much better than anyone else, so this is just spitballing rather than a recommendation. On 19 December 2013 11:16, Nu Era <[email protected]> wrote: > You can use the cluster module to create worker threads to do the work and > have the master manage the sockets and communication. > > This also allows you to make changes to the worker code and gracefully > restart workers without completely killing the server, for example: > > master: > fork 2 workers > listen for connections > listen for worker_restart_message > on connection -> > if (workers.are.available) send socket to (roundrobin.worker) > otherwise wait_until_workers_are_available WHILE still accepting + > buffering new connections > on worker_restart_message -> > ask all workers to gracefully exit (finish dealing with their current > work and close) > restart worker threads *(potentially on new versions of code)* > flush all pending connections that built up while we were restarting > to the workers > > worker: > listen for messages > on message > do work then send message to master when complete > > I would be very careful about using this in practice/production but it > definitely can work if you do it right :-) > > Your boss will be very happy - and you now have a lot of work to do ;-) > > > On Thursday, December 19, 2013 1:26:27 AM UTC-7, SipherHex1984 wrote: >> >> Hello, First of all I am having a bit of an issue. I have been a PHP >> developer for many years now. I have always seen a need for sockets in JS. >> Recently I am trying to come up with a nodejs for the company I am >> currently working for. What I am looking for is a way to have a single app >> that listens for io.on events then dispatches them to a different app. Thus >> freeing up the primary app to accept more requests and allow the second app >> to do the heavy lifting then pass the socket/event back to the primary app >> when it is done. My boss found something like this in spidermonkey but I >> have yet to figure out how to achieve this with Node. The second point I am >> trying to achieve is having a main apps that get compiled when the are >> created. Currently my boss it not happy with the idea of having to restart >> the node app each time we would like to change or add to it. Currently I >> have written a node app to serve out json object files through a socket io >> connection but, it is in a single app. We are looking for something where >> the main app calls the json app which goes and gets the json sends it to >> the client then checks in with the server when its done. Does anyone know >> how or IF i can achieve something like this. The closest I have gotten was >> using FS to get the second node apps code then eval it. >> > -- > -- > 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Richard Marr -- -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
