←back to thread

3 points wkyleg | 1 comments | | HN request time: 0.21s | source

Right now, JavaScript scales well with a single-threaded event loop. Certainly not as fast as something like Go for async tasks, but enough to power much of the web and be easy to write.

Why hasn't anyone abstracted the event loop model to scale across multiple machines or utilize modern processors? Perhaps with something more like an Actor model or Erlang's BEAM?

It seems like just getting the JavaScript concurrency model as an abstraction over multicore or multi-machine concurrency would be one of the easiest ways to achieve this. I realize that this is still technically difficult, but programming tends towards "just porting things to JavaScript." I would love to have something like Phoenix framework, just built with JavaScript/TypeScript, and I can scale a back end by bumping size of a machine or scaling horizontally.

1. hehehheh ◴[] No.42176945[source]
Its a good question. There are worker threads in Node but they seem clunky to use:

https://bitsfactory.lilanga.me/posts/nodejs-utilize-multi-co...

Stateless webservers are easier, since this is merely loaf balancing. Just run more processes:

https://stackoverflow.com/questions/2387724/node-js-on-multi...