Multithread execution

In order to meet some CPU intensive computing scenarios, upgrade node to the latest version, and hope to adjust the relevant code of the core execution engine and enable multithreading.

1 Like

The new worker threads API is something I'm aware of, but it would be a major piece of work to modify the runtime to use them.

There have been previous pieces of work to look at the older cluster module to do a similar thing. Worker threads make some of the message passing easier, but there are still significant architectural challenges needed.

Certainly something worth investigating, but not something that can just be done.

I wonder if it would be interesting to have a worker node? Something that could offload some processing. A simple version might be a variation on the function node?

Just a thought and could be done by an interested party rather than starting with changes to core.

There's nothing stopping individual nodes from exploring the worker API. They would have to solve all the same issues around passing data between the main thread and the workers. There are libraries emerging to make it easier, such as - but you can't escape the fact the worker doesn't have direct access to things like Context, so all work needs to be marshalled across the thread boundary. It does also pin the minimum Node version to 12.x.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.