If there are 100 users than node.js access try to access all process at a time and delay other user process/It may use timesharing so if one user process requires 2 second than if there are 10 users requesting to same node js than 20 seconds require to run task so I want to create queue or if you have better solution than tell me
php code
exec("node comiple_java.js 2>&1",$output,$ret_value);
compile_java.js
var exec = require('child_process').exec;
var fs = require('fs');
var user_id = process.argv[2];
var path = './'+user_id+'/';
var command = "cd "+path+" & java Main < input.txt";
exec(command ,{maxBuffer:1024*800,timeout:20000}, function( error , stdout , stderr ){
if(error)
{
if(error.toString().indexOf('Error: stdout maxBuffer exceeded') != -1)
{
console.log('Error: Stdout maxBuffer exceeded. You might have initialized an infinite loop.');
}
else
{
console.log('Error: Program contained an error while executing');
}
}
else
{
fs.writeFile( path + "/out.txt" , stdout , function (err){});
console.log(stdout);
}
});