0

What are the main differences between node cluster and Threads agogo and what are the advantages or disadvantages of each? As far as I have understood threads a agogo creates a thread to run in the background and node cluster creates a new process that is run in the background. I am interested what differences there would be in ease of use or performance and when to prefer one over the other.

Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
Coder3000
  • 130
  • 7
  • You cannot have this threads-a-gogo API without Node itself, asking "node vs node-module" sounds a little off to me. You should read about threads and (forked) processes in general. Generally speaking about performance, "native" is always faster but modules / APIs / framework grant you an advantage in handling and programing faster. – Daniel W. Nov 06 '15 at 13:36
  • Oops I ment node with cluster or threads a agogo with node – Coder3000 Nov 06 '15 at 13:37
  • What do you mean by "cluster" ? You can combine - build a node.js cluster supporting threads-a-gogo framework. – Daniel W. Nov 06 '15 at 13:38
  • @DanFromGermany the question aims at the cluster module which is a load balancer for threads – eljefedelrodeodeljefe Nov 06 '15 at 13:42

1 Answers1

0

Just having a quick look, it uses threads, yes. Node on the other hand uses processes, since it's design is single-threaded, however internally it creates thread pools and hence threads during callback creation.

Node implementations of processes uses sockets for communication, which is quite slow, in terms of latency. Your tasks should hence be dividable, so you won't need to have much communication. Threads are like processes, but share the memory with their calling processes, so that communications is quicker, but more dangerous.

So, the question is rather aims are threads better then processes for concurrency? It depends... But in Node context use cluster and processes rather.

The library you are referencing to is quite old right? Better don't use it. There is a reason why people abandon stuff like this.

eljefedelrodeodeljefe
  • 6,304
  • 7
  • 29
  • 61
  • ok, but is there also something newer or an alternative to node cluster – Coder3000 Nov 06 '15 at 13:43
  • For node concurrency? No, nothing I could recommend. There is tons of stuff, but it's likely to share the same fate. Embrace Node streams rather and cluster processes. This is by far the fastest way. – eljefedelrodeodeljefe Nov 06 '15 at 13:45