Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 5 targeting dnx451/dnx46 Performance

With ASP.NET 5 everything is suppose to be opt in based, the app loads opted libraries only which is amazing. Older ASP.NET functionality was encapsulated in System.Web namespace, which had everything you could possibly need to build an ASP.NET application. There was a real cost to stuffing all those unused libraries in memory, so ASP.NET 5 approach is to opt in for what you need and not lug around large libraries of unused code.

My Questions:

  1. Is this opt in approach and performance improvements only available for ASP.NET 5 targeting .NET CORE? or does ASP.NET 5 targeting the full framework on Windows get all these nice features?

  2. When targeting dnx451 or dnx46, are they still dependent on System.web and are all unused libraries still loaded into memory like older versions of ASP.NET?

  3. ASP.NET 5 supposedly takes around 2kb memory per request while older version of ASP.NET took up to 30kb per request. Is this great performance enhancement only possible when targeting dnxcore50? or is this the case also for dnx451/dnx46?

  4. When running ASP.NET 5 dnx46 on IIS 7.5+, is System.web still not loaded? (Not sure, but I think IIS and System.web are integrated, correct me if I am wrong).

  5. Lastly, what is the difference between an ASP.NET 4.6 app and an app running on ASP.NET 5 (dnx46)? what improvements does the latter hold over the other?

Someone PLEASE clarify this for me? I can't seem to find a clear answer to these questions.

like image 685
Cindro Avatar asked Dec 14 '15 19:12

Cindro


1 Answers

Is this opt in approach and performance improvements only available for ASP.NET 5 targeting .NET CORE? or does ASP.NET 5 targeting the full framework on Windows get all these nice features?

No, a large part of the improvements offered by ASP.NET 5 are also applicable to DNX451 (aka the "full framework" version). It's specially true with Kestrel (the new "universal" web server for ASP.NET 5), where the massive RPS improvements impact both versions.

When targeting dnx451 or dnx46, are they still dependent on System.web and are all unused libraries still loaded into memory like older versions of ASP.NET?

No. With the new hosting layer, System.Web is never loaded, even when using IIS.

ASP.NET 5 supposedly takes around 2kb memory per request while older version of ASP.NET took up to 30kb per request. Is this great performance enhancement only possible when targeting dnxcore50? or is this the case also for dnx451/dnx46?

Thanks to the great job made by the community in Kestrel, the allocations (and thus, the "bytes per request") have massively decreased since the first beta, and this affects both versions. Using CoreCLR will more likely help decrease the memory needed to host the entire application (since you reference lighter assemblies), but the impact on the "bytes per request" should be hardly noticeable.

Of course, CoreCLR's impact will mainly depends on how many references you have in your project: in most cases though, the memory gain should really be marginal (you have lighter assemblies, but due to the fully modularized nature of CoreCLR, they are far more numerous).

When running ASP.NET 5 dnx46 on IIS 7.5+, is System.web still not loaded? (Not sure, but I think IIS and System.web are integrated, correct me if I am wrong).

Nope, thanks to the new hosting layer (IIS's previous integration, Helios, used to load System.Web, but it's no longer true with HttpPlatformHandler). Note that IIS no longer "hosts" your application: it now just acts as a reverse proxy. Everything is actually handled in a separate DNX worker process, started and monitored by IIS.

Lastly, what is the difference between an ASP.NET 4.6 app and an app running on ASP.NET 5 (dnx46)? what improvements does the latter hold over the other?

Hosting an "ASP.NET 4.6 application" on the new stack will be a complicated thing (if not impossible), specially if it relies on System.Web and doesn't use an abstraction layer like OWIN (ASP.NET 5 provides a compatibility layer with OWIN).

like image 128
Kévin Chalet Avatar answered Nov 15 '22 04:11

Kévin Chalet