简体   繁体   English

Node.Js VS HttpAsync(asp.net)

[英]Node.Js VS HttpAsync (asp.net)

After reading a lot of stuff about nodejs, I still ask my self : 在阅读了很多关于nodejs的内容后,我仍然问自己:

What are the benefits over asp.net HttpAsync requests ? 与asp.net HttpAsync请求相比有什么好处

The only limitation ( as I see) is the concurrent number of requests which IIS limits. 唯一的限制(如我所见)是IIS限制的并发请求数。

I tried to paint how I currently understand it : 我试着描绘我目前如何理解它:

在此输入图像描述

any help ? 任何帮助?

  • is there anything that asynchronous operations on .net/ado.net can't do that nodejs can ? 是什么.net/ado.net上的异步操作不能做nodejs可以做的事情?

IIS limits the number of concurrent requests to a high number by default. IIS默认情况下将并发请求数限制为高数。 The limit can be raised arbitrarily though. 但是可以任意提高限制。

There are two main benefits attributed to node.js: node.js有两个主要好处:

  1. Scalability (not performance! there is a difference) due to async IO 由于异步IO,可扩展性(不是性能!存在差异)
  2. Sharing Javascript with the client 与客户端共享Javascript

ASP.NET does not support number 2 so that is an advantage. ASP.NET不支持2号,因此这是一个优势。

Async IO and non-blocking code is fully supported by ASP.NET. ASP.NET完全支持异步IO和非阻塞代码。 Plus, you get the performance advantage of a JITed statically typed language. 此外,您还可以获得JITed静态类型语言的性能优势。 For that reason ASP.NET generally has superior performance to node.js for non-toy applications (printing "hello world" is not a real benchmark workload! neither is sleeping for 10 seconds). 出于这个原因,ASP.NET通常对非玩具应用程序的node.js具有优越的性能(打印“hello world”不是真正的基准工作负载!它们都没有睡眠10秒)。

node.js benefits from the extremely slim code-path it has. node.js受益于它非常纤薄的代码路径。 For that reason very minimal applications like "echo" or "hello world" are probably faster. 因此,非常小的应用程序,如“echo”或“hello world”可能更快。 This does not hold for apps which actually perform work. 这不适用于实际执行工作的应用程序。

So if you want to know which is "better" you need to consider a particular scenario. 因此,如果您想知道哪个“更好”,您需要考虑特定情况。 Benchmark with a realistic workload (no, calculating a factorial number is not realistic. C# is just going to win by a large amount. Means nothing). 具有实际工作量的基准(不,计算一个因子数是不现实的.C#只会大量获胜。没有任何意义)。 Also factor in maturity of the platform, libraries, documentation, support, developer productivity, .... 也考虑到平台,库,文档,支持,开发人员生产力的成熟度......

The main difference between node.js and ASP.NET is the library eco system. node.js和ASP.NET之间的主要区别是库生态系统。 Most node.js libraries provide an asynchronous way. 大多数node.js库提供了一种异步方式。 ASP.NET methods don't, only a few of them do. ASP.NET方法没有,只有少数几个。 And if there is something synchronous along the way, the point of being asynchronous is lost. 如果在此过程中存在同步,则异步点将丢失。

That's the problem most platforms have compared to node.js. 这是大多数平台与node.js相比的问题。

Otherwise, just using this AsyncHttp method, there is no difference between ASP.NET and node.js. 否则,只使用这个AsyncHttp方法,ASP.NET和node.js之间没有区别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM