Node Cluster scheduling policy | Load Balancing for Read Scalability

121 views
Skip to first unread message

Emerson Rocha Luiz

unread,
Jun 22, 2015, 10:22:36 AM6/22/15
to nod...@googlegroups.com
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?

Att.
Emerson

Ryan Schmidt

unread,
Jun 22, 2015, 11:47:08 PM6/22/15
to nod...@googlegroups.com
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.



ala...@bonseletrons.com.br

unread,
Jun 23, 2015, 7:35:45 AM6/23/15
to nod...@googlegroups.com
Maybe HAproxy can do that, it has some interesting routing options
It may be worth checking



Enviado através do AquaMail para Android
http://www.aqua-mail.com


A 23 de junho de 2015 00:47:02 Ryan Schmidt <googl...@ryandesign.com>
escreveu:
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to nod...@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.



Sam Roberts

unread,
Jun 23, 2015, 1:05:40 PM6/23/15
to nod...@googlegroups.com
On Sun, Jun 21, 2015 at 9:51 PM, Emerson Rocha Luiz <fit...@gmail.com> wrote:
> So, on this type of load balancing (workers scheduling policy based on
> WRITE/READ request), is possible use node-cluster?

node-cluster is for "symetrical" servers: ones in which each server is
identical.

For routing requests based on content, use nginx , and run two apps,
on different ports, one the read-only, the other the write-only. They
can have the same code, just run them separately (each app can use
cluster, which you don't have to embed into your app, use a process
manager, like http://strong-pm.io).
Reply all
Reply to author
Forward
0 new messages