0

I need to figure out the count of all active connections for an entire node.js cluster. I've implemented a dirty solution using IPC where the master process keeps track of responses from each worker and then returns the sum. Isn't there a cleaner way to calculate the number of active connections for an entire cluster?

Anshuul Kai
  • 3,876
  • 2
  • 27
  • 48
  • As far i have used cluster, you can use "cluster.workers" for getting active workers. – Abhay Jul 24 '17 at 04:10
  • That is what I use for IPC. Trying to figure out the count of connections that each worker holds and then return the sum via one simple call. – Anshuul Kai Jul 24 '17 at 04:11
  • Okay, you mean to say, no. of connections a worker can withstand with. – Abhay Jul 24 '17 at 04:12
  • 1
    There's not really any other way to do it. The master sees an initial connection, but then passes it off to a child and no longer has the ability to track that connection once it is handed off to the child so you have to ask each child how many they currently have and add them up. – jfriend00 Jul 24 '17 at 04:13

0 Answers0