You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Hello,
I've been trying nodejs 0.12..3 on my windows 7 pc (4 cores).
My test is focused on multicore connection processing (see the code below) using cluster module.
varcluster=require('cluster');varhttp=require('http');varnumCPUs=require('os').cpus().length;if(cluster.isMaster){// Fork workers.for(vari=0;i<numCPUs;i++){cluster.fork();}cluster.on('exit',function(worker,code,signal){console.log('worker '+worker.process.pid+' died');});}else{myApp();}functionmyApp(){// Workers can share any TCP connection// In this case its a HTTP serverhttp.createServer(function(req,res){console.log('[httpServer] new request');res.writeHead(200);// connection will be hanging forever while(true){for(vari=0;i<10000000;i++){}res.write("chunk!!!");}res.end("this is the end\n");}).listen(3000,function(err){if(err)console.error(err);console.log('listening on port 3000');});}
My test is : launch 8 connections in parallel (with curl). Note: I launch 8 connections because I'm on a 4 core PC.
The result: only connections number 1, 3, 5 and 7 will be processed in parallel (ie: receiving chunk!chunk!chunk!...)
The text was updated successfully, but these errors were encountered:
What are you expecting to happen? You have four child processes. Each one receives a connection and then you put it into an infinite loop so that it can't accept any new connections.
I believe that on Windows, the operating system controls which requests are sent to which threads. I wonder if you'd have different results on a different OS using the round robin scheduler.
Hello,
I've been trying nodejs 0.12..3 on my windows 7 pc (4 cores).
My test is focused on multicore connection processing (see the code below) using cluster module.
My test is : launch 8 connections in parallel (with curl). Note: I launch 8 connections because I'm on a 4 core PC.
The result: only connections number 1, 3, 5 and 7 will be processed in parallel (ie: receiving chunk!chunk!chunk!...)
The text was updated successfully, but these errors were encountered: