i have in application calculation like
var points= [...3000]; (var = 0; < points.length; i++) { (var j = i+1; j < points.length-1; j++) { (var k = k+1; k < points.length; k++) {} } }
i use 2 core processor , 2gb of ram , calculation solved in 97132ms did upgrade on server , i'm using 4 core , 8gb of ram, got same result after upgrade
i try
if (cluster.ismaster) { var numcpus = os.cpus().length; // master: // let's fork many workers have cpu cores (var = 0; < numcpus; ++i) { cluster.fork(); }
and execute application node --nouse-idle-notification --expose-gc --stack_size=7168 --max-old-space-size=7168 bin/www
i think de node v8 doesn't use 100% cpu
node.js runs javascript in single thead , uses 1 core running it. so, if javascript compute bound, use 1 core , performance not fundamentally differ 2, 4 or 8 core computer.
some modules written in native code may use native threads of work (which may bring other cores play), not apply execution of own javascript.
long running cpu-bound calculations can spawned process can communicate it's results. when fire process, creating opportunity system use different core other process.
clustering creates opportunity run multiple independent copies of process can each carry out own separate jobs. but, if you're timing 1 particular job, job going executed in 1 of clusters , use 1 of cpus.
node.js not use multiple cpus speed 1 javascript execution task.
Comments
Post a Comment