2 ms·
NodeJs' non-blocking IO makes it a great choice for near real-time communication, like streaming editors, messaging, reacting to high freq events (like metrics)
by ignoramous 11y ago
NodeJs' non-blocking IO makes it a great choice for near real-time communication, like streaming editors, messaging, reacting to high freq events (like metrics). See: http://socket.io http://socket.io, http://en.m.wikipedia.org/wiki/Surespot http://en.m.wikipedia.org/wiki/Surespot and https://github.com/etsy/statsd https://github.com/etsy/statsd
It is also great when you want to prototype a REST backend, and get it up and running in no time. The simplicity of javascript along with nodejs' module ecosystem make it a breeze (Ruby equivalent would be Sinatra).
What nodejs isn't good at is, parallelism. Concurrency is handled for you for free by the underlying libuv eventing framework. Pseudo-parallelism is achieved using 'clusters' but communication between node processes is costlier than in other languages that support parallelism out of the box.
Read https://news.ycombinator.com/item?id=4305486 https://news.ycombinator.com/item?id=4305486 for aphyr's excellent commentary on clojure vs nodejs (you can also find Ryan Dahl defending nodejs in a few cases there)