nodejs多线程如何实现(NodeJs 多核多进程并行框架实作 CNode)
NodeJs 多核多进程并行框架实作
Linux 2.6.18-164.el5xen x86_64
CPU X5 ,Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
free -m
total used free shared buffers cached
Mem: 7500 3672 3827 0 863 1183
ransactions: 100000 hits
Availability: 100.00 %
Elapsed time: 10.95 secs
Data transferred: 1.05 MB
Response time: 0.01 secs
Transaction rate: 9132.42 trans/sec
Throughput: 0.10 MB/sec
Concurrency: 55.61
Successful transactions: 100000child req total : 23000
child req total : 16000
child req total : 17000
child req total : 22000
child req total : 22000child req total : 13000
child req total : 30000
child req total : 14000
child req total : 22000
child req total : 21000
(#1) TCP.bind --- > TCP.listen (process.binding(“tcp_wrap ”))|
|TCP.emit(“connection ” ,handle)
|
(#2) Wrap TCP handle to Socket (Tcp.onconnection)
|
|Net.Server.emit( ”connection ” , socket)
|
(#3)Create Req ,Res based on a Socket(net.server.connectionListen)
|
|Http.server.emit(“request ” ,req ,res)
|
(#4)your code writen here :function(req ,res){
res.writeHead(200 ,“content-type/text/html ”);
res.end(“hello,world ”)
}
ransactions: 100000 hits
Availability: 100.00 %
Elapsed time: 10.47 secs
Data transferred: 1.05 MB
Response time: 0.01 secs
Transaction rate: 9551.10 trans/sec
Throughput: 0.10 MB/sec
Concurrency: 60.68
Successful transactions: 100000child req total : 20000
child req total : 20000
child req total : 20000
child req total : 20000
child req total : 200000 -> /dev/pts/30
1 -> /dev/pts/30
10 -> socket:[71040]
11 -> socket:[71044]
12 -> socket:[71054]
2 -> /dev/pts/30
3 -> eventpoll:[71027]
4 -> pipe:[71028]
5 -> pipe:[71028]
6 -> socket:[71030]
8 -> socket:[71032]
9 -> socket:[71036]0 -> socket:[71031]
1 -> /dev/pts/30
2 -> /dev/pts/30
3 -> eventpoll:[71049]
4 -> pipe:[71050]
5 -> pipe:[71050]
创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!