3 ms·
> If all async functions are immediately awaited, there is only one thread of execution - no concurrency. In a Node web server process, though, this isn't real
by hn_throwaway_99 5y ago
> If all async functions are immediately awaited, there is only one thread of execution - no concurrency.
In a Node web server process, though, this isn't really true. If you perform a CPU intensive task on the main event loop, all other incoming requests will pause. Using worker threads instead turns that CPU task into, for all intents and purposes, an async io call, freeing the main event loop to handle concurrent incoming requests.
Since handling CPU intensive tasks is the main downside of a Node web app, I think this library is a great solution for that (I think this library's API is a much easier to use wrapper around native Worker threads).