CNode

nodejs官方cluster测试(2)

Zzaobao发布于13 年前最后回复13 年前5 回复6292 浏览0 收藏
A worker with #2 is now connected to 0.0.0.0:80
A worker with #4 is now connected to 0.0.0.0:80
A worker with #5 is now connected to 0.0.0.0:80
A worker with #8 is now connected to 0.0.0.0:80
A worker with #1 is now connected to 0.0.0.0:80
A worker with #3 is now connected to 0.0.0.0:80
A worker with #6 is now connected to 0.0.0.0:80
A worker with #7 is now connected to 0.0.0.0:80
A worker with #9 is now connected to 0.0.0.0:80
A worker with #10 is now connected to 0.0.0.0:80
Worker #1 has a request
Worker #7 has a request
Worker #6 has a request
Worker #3 has a request
Worker #8 has a request
Worker #5 has a request
Worker #4 has a request
Worker #2 has a request
Worker #10 has a request
Worker #9 has a request
Worker #1 makes a response
Time: 5003ms
Worker #1 has a request
Worker #7 makes a response
Time: 5005ms
Worker #6 makes a response
Time: 5008ms
Worker #3 makes a response
Time: 5004ms
Worker #8 makes a response
Time: 5008ms
Worker #5 makes a response
Time: 5008ms
Worker #4 makes a response
Time: 5004ms
Worker #2 makes a response
Time: 5001ms
Worker #10 makes a response
Time: 5000ms
Worker #9 makes a response
Time: 5000ms

另外,火狐浏览器在一个请求超过一秒并且失败时,会再次发送该请求,但不会发送第三次,所以在模拟宕机的测试中,开一个Firefox的标签,你会发现实际宕掉两个worker。

查看回复

回复 (5)

S
seasonx4#1·13 年前

多线程/多进程/单线程事件驱动 任何1种都是高性能的

NODE属于第三种, 弄CLUSTER反而享受不了JS的原生特性,徒添消耗

S
seasonx4#5·13 年前
引用 seasonx4多线程/多进程/单线程事件驱动 任何1种都是高性能的 NODE属于第三种, 弄CLUSTER反而享受不了JS的原生特性,徒添消耗

@dgq420377903 比如聊天应用,张三向李四发送消息,是进程A处理的;但李四被系统回复说没有他的信息,因为这是是进程B处理的李四请求

参与回复
登录后即可参与回复。登录