Hacker News new | past | comments | ask | show | jobs | submit
Reading the article, I didn’t see this answered: why not scale to more nodes if your workload is CPU bound? Spin off 1 cpu and a few gb of ram container and scale that as wide as you need?

e.g., this certainly helps when the event loop is blocked, but so could FFI calls to another language for the CPU bound work. I’d only reach for a new Node thread if these didn’t pan out, because there’s usually a LOT that goes into spinning up a new node process in a container (isolating the data, making sure any bundlers and transpilers are working, making sure the worker doesn’t pull in all the app code, etc.).

Side car processes aren’t free, either. Now your processes are contending for the same pool of resources and can’t share anything, which IME means more likelihood of memory issues, esp if there isn’t anything limiting the workers your app can spawn.

Still, good article! Love seeing the ways people tackle CPU bound work loads in an otherwise I/O bound Node app.

> but so could FFI calls to another language for the CPU bound work

Worker threads can be more convenient than FFI, as you don't need to compile anything, you can reuse the main application's functions, etc.

loading story #47480166
> few gb of ram ...

5 years ago I never would have given this comment a second thought.

Now I read it and have to wonder: when does the price of ram start showing up in the butchers bill from your cloud provider?

loading story #47480131
loading story #47479194