On Jun 21, 2015, at 11:51 PM, Emerson Rocha Luiz wrote: > How (if possible) to use node-cluster to schedule which worker will respond > to a request, based on type of request e.g. one worker for write > (POST/PUT/DELETE methods) and 1+ worker only for read (GET)? > > This is common on Load Balancing databases, where master server is for Write, > and slaves have a carbon copy of the master data and can serve much faster, > with less CPU usage and better query cache. > > On my NodeJS web service, I have a very fast read requests, even more faster > with varnish cache, but with a small and constant amount of write requests, > sometimes CPU intensive, lock entire thread by 0.1s~0.3s. In this case, even > if I just spawn the node application with both READ/WRITE requests, I will > still have the same problem, since each WRITE request will slow down all > process. This is why I suppose use the same strategy as some databases could > be a good idea. > > So, on this type of load balancing (workers scheduling policy based on > WRITE/READ request), is possible use node-cluster?
As far as I know, node's built-in cluster does not do anything like that. It just passes incoming requests to an available worker. I don't know if there is any way to influence which worker it uses. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/8ED34098-F3E9-4D17-A789-AA91E9C4B8B0%40ryandesign.com. For more options, visit https://groups.google.com/d/optout.