This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cluster: add example for message passing
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1e3e6b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question about cluster and the use case for why I would spin up multiple forks versus manage the processes myself. My goal is to have a zero downtime environment on one box. So for this, I usually run 2 of my server processes (on different ports, behind a proxy). Then when I want to do an upgrade or bounce the webserver, I bounce the first one (it stops accepting new connections and gracefully ends old ones). This means the proxy now uses the second one for all requests. I then bring back the first one and do the same with the second process (different port).
My understanding (and it may be wrong) is that with cluster, I will have the benefit of multiple processes, but I won't have the nice zero downtime capability because if I bounce the master process the children are also brought down and there is potentially a service gap. Is this correct?
1e3e6b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shtylman: You can have two masters listening on different ports, each with its own set of workers. Not sure what you mean by 'bounce'. If you stop forwarding requests to one of the masters, eventually it'll have processed all outstanding requests and then you can safely upgrade it. I don't see how that is different from a non-clustered solution.
1e3e6b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my point was that the reason I use different processes is to be able to do a stable rollout, not because I have 4 cores and if I just ran 1 process I would not be using the cores. I am not against cluster, just thought maybe some notes about a zero downtime usecase would be helpful for new people starting out. I can deff see many people thinking that they can just run one instance (having cluster shard to N cores) and not think about the benefits of multiple disjoint processes.