3 ms·
The nice thing about Node.js's design is that (almost) all IO is non-blocking by design, so developers can't block their programs on IO by accident. In other p
by aphexairlines 8y ago
The nice thing about Node.js's design is that (almost) all IO is non-blocking by design, so developers can't block their programs on IO by accident.
In other platforms developers need discipline to choose non-blocking APIs over blocking ones, or to wrap their blocking calls in async execution contexts like threads or coroutines.
- bschwindHN 8y agoI'm just disagreeing that it's "really hard" for languages besides JavaScript. Concurrency in Go is stupid easy, it's built into the language. Pretty sure Elixir is the same story. C++ and Rust are slightly more difficult but still nowhere near "really hard" when it comes to making a socket server that can serve hundreds of thousands. Here's a nice WebSocket server in C++: https://github.com/uNetworking/uWebSockets/blob/master/README.md https://github.com/uNetworking/uWebSockets/blob/master/READM...
- Rapzid 8y agoAll the "sync" commands are blocking. In my experience developers need discipline to avoid using those and blocking the whole app. Of the languages mentioned I believe Go is actually closest to all io being non blocking by default; with the caveat that you are using multiple go routines.