Add worker support#693
Conversation
Prep work for supporting Workers.
It starts children on ports already in use.
Unfortunately there seems to be no way to enumerate all of the workers running. The alternative would be a broadcast channel, but then all of the siblings would have to listen to each other's metrics, which would not be good. fixes siimon#656
…ent. This implementation uses BroadcastChannels to announce Workers that can export prometheus telemetry, and to collect the data. Supports workers coming online before the collector by re-announcing on seeing the 'primary' come online.
|
This should get faster as well in a few Node.js versions: |
|
@jdmarshall Hi! I would like to know if this PR will be accepted soon enough :) |
|
Like the cluster code, you need to fire up the aggregator in each worker. It’s using broadcast channels because the NodeJS team is still working on arbitrary communication between workers other than parent child. It should work fine with piscina. |
|
@jdmarshall Interesting! Can you provide me a simple example of doing this? |
SimenB
left a comment
There was a problem hiding this comment.
I forgot to submit this review 🙈
Code review feedback.
Similar to cluster support, but also allows for the 'main' thread to not be responsible for aggregation. The user can opt to send all aggregation to a dedicated worker, thereby avoiding crowding up the main thread, as is the problem in #628.
This answers #401