-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node WorkerChannel native addon #1394
base: v3
Are you sure you want to change the base?
Conversation
Substitute spawning a process with mediasoup for running mediasoup in a thread created by this addon. The communication is now done via message passing rather than using unixsocket, avoiding the kernel networking stack for each and every message passed from Node to C++ and viceversa. Performance gains are enhanced by approximately 8 times. Tested by sending a request from Node to C++ and waiting for the response N times in a loop.
|
Please merge v3 and check prettier and eslint path arrays in npm-scripts.mjs |
assign JS instance of the addon to 'undefined' when closed, to indicate the Node GC that it can be freed. Otherwise the tests won't finish due to the correponsing handles being opened.
Lower npm versions than 10.3.0 fail building the addon. Error: No module named 'distutils'
Update: This PR is almost ready to be shipped if we want to. The are two main concerns already defined in the PR description:
Having said this, do we still want to go in this direction?. As indicated in the description:
But of course it comes with the mentioned caveats too. |
If there use cases where the performance gap is that large, I think it is worth it. The proper solution to crashes is largely to write code that doesn't crash rather than running it in a separate process. |
I think that keeping the current design just to keep the "benefit" of not crashing the node process if the worker fails is not a good argument so I am ok but: How does this change affect prebuilt worker binaries? Now they should not be "binaries" but "libraries" so more changes are needed specially in the naming of those assets and the function in npm-script that fetches them. |
Yes, there is a TODO for this. 👍, |
Substitute spawning a process with mediasoup for running mediasoup in a thread created by this addon.
The communication is now done via message passing rather than using unixsocket, avoiding the kernel networking stack for each and every message passed from Node to C++ and viceversa.
Performance gains are enhanced by approximately 8 times. Tested by sending a request from Node to C++ and waiting for the response N times in a loop.
Caveats:
TODO: