Reputation: 432
I have used child process in my electron application. and I forked child process only after the previous child process ends. And also if I fork multiple processes, it won't increase the speed.
so can I able to use the cluster module in electron application to fork multiple child processes at the same time.
let doneFunction = {}
let queue = createQueue(1);
this.state.files.forEach((file, i) => {
queue.defer(function(details, done) {
readSizeRecursive(details.path, e); // inside that i forked child
doneFunction = done;
}, file);
});
childFinished = () => {
doneFunction()
}
I previously asked Child process maximum limit but I can't any answer.
Upvotes: 2
Views: 390
Reputation: 176
And also if I fork multiple processes, it won't increase the speed.
To increase the speed, you need to speed up the bottleneck which is disk IO in your case(directory size calculation etc...). CPU is much faster than disk IO, therefore multi/single threads/processes just do not matter.
if I forked two cluster means, and I fork two child process means, each child runs parallel in two different clusters?
yes, but it will not speed up your final result as mentioned above
Upvotes: 2
Reputation: 2111
You may have a better understanding of cluster mode from this article Cluster definition in depth
But I personally recommended to use Nginx
for such things.
Take a look in NgInx
I hope it helps. happy Coding :)
Upvotes: 1