What difference between node.js non-blocking model and ASP.NET MVC non-blocking async/await with Tasks ? i meant they successfully solving the same problem in the same way or i missed something ? I think other framework have had the same solution before node ?
At a high level, they are equivalent, with one major difference. In Node, all requests are handled on the same thread; whereas in ASP.NET, all requests are handled by the thread pool. Node is a single-threaded asynchronous approach, while ASP.NET is a multi-threaded asynchronous (or synchronous) approach.
For this reason, Node cannot handle synchronous APIs at all, and if there is an API that should be asynchronous but isn't, Node will pretend it's asynchronous by pushing it onto a thread pool thread so that the main thread can continue handling other requests.
In contrast, ASP.NET is multithreaded from the get-go, so pushing synchronous work onto a thread pool thread is an anti-pattern in that environment.
In theory, this would imply that ASP.NET is more scalable on a multi-core server, but AFAIK no one has proven/disproven that. One mitigating approach that Node servers can use is to run multiple copies of Node on the same server, along with a load balancer (nginx, or just another copy of Node). However, any shared state / caches are forced to be out-of-proc at that point.
Regarding which one was "first" to support asynchrony, I'd bet probably ASP.NET. ASP.NET has supported asynchrony since it's first release, and MVC added support in 2.0 IIRC. However, it's not until the recent release of .NET 4.5 with async
and await
that asynchrony has become (relatively) easy; before that, most companies did not deem it worth the complexity.
From what I gather, the only difference is in Node.js, non-blocking is the only way to do I/O. Whereas in .NET you can block threads if you really want to. There may be legitimate reasons for this, btw. But, in Node.js you don't really have this option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With