-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node的原生cluster模块 #56
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
主进程和子进程
cluster.worker.process 等价于 process(在子进程中)
可见主进程与子进程通过这样一个三角关系互相通信,其中 cluster 和 worker 是在主进程中获取的,process(child) 是子进程。 cluster 通过操作 worker 通知子进程,子进程本身和 cluster 进行通信。为什么要这样设计呢?因为子进程会有多个,只有通过 worker 才能选择和哪个进程通信。
遍历所有子进程
通信
主进程全局监听来自子进程的信息
子进程主动触发事件,与主进程通信
主进程主动和子进程通信
伪造多请求
可以使用多个子进程发送数据,伪造请求:
参考文档
The text was updated successfully, but these errors were encountered: