Earlier quoted context omitted.
Running a Node worker for each thread is standard practice. No different than having a dedicated threadpool for asynchronous programming on the JVM. Yes blocking the event loop is easy. No it's not THAT easy. I've never done it because you think about it while writing code. It's part of the environment. I have had to fix lots of reports etc that try to load up the world and iterate through it in a loop that doesn't y…
> Yes blocking the event loop is easy. No it's not THAT easy. I've never done it because you think about it while writing code. To be pedantic, all JavaScript functions block the event loop. It's just that the vast majority of functions execute so quickly that the amount of time your function blocks is very short. I once had a loop that processed tons of data and would block the event loop for 1-3 seconds. I ended up…
At one company I built API middleware that calculated time spent in the event loop vs waiting on dependencies (other apis, Redis, etc) by managing a couple counters per request. It was very helpful.