Scott Hanselman

Useful ASP.NET Core 2.2 Features

December 14, 2018 Comment on this post [9] Posted in ASP.NET | DotNetCore
Sponsored By

Earlier this week I talked about how I upgraded my podcast site to ASP.NET Core 2.2 and added Health Check features fairly easily. There's a ton of new features and so far it's been great running on my site with no issues. Upgrading from 2.1 is straightforward.

I wanted to look at just a few of these that I found particularly interesting.

You can get a very significant performance boost by moving ASP.NET Core in process with IIS.

Using in-process hosting, an ASP.NET Core app runs in the same process as its IIS worker process. This removes the performance penalty of proxying requests over the loopback adapter when using the out-of-process hosting model.

After the IIS HTTP Server processes the request, the request is pushed into the ASP.NET Core middleware pipeline. The middleware pipeline handles the request and passes it on as an HttpContext instance to the app's logic. The app's response is passed back to IIS, which pushes it back out to the client that initiated the request.

HTTP Client performance improvements are quite significant as well.

Some significant performance improvements have been made to SocketsHttpHandler by improving the connection pool locking contention. For applications making many outgoing HTTP requests, such as some Microservices architectures, throughput should be significantly improved. Our internal benchmarks show that under load HttpClient throughput has improved by 60% on Linux and 20% on Windows. At the same time the 90th percentile latency was cut down by two on Linux. See Github #32568 for the actual code change that made this improvement.

HTTP/2 is enabled by default. HTTP/2 may be sneaking up on you as for the most part "it just works." In ASP.NET Core's Kestral web server HTTP/2 is enabled by default over HTTPS. You can see here at both the command line and in Chrome I'm using HTTP/2 locally.

HTTP/2 locally

Here's Chrome. Note the "h2."

HTTP/2 in Chrome

Note that you'll only be able to get HTTP/2 when ALPN (Application-Layer Protocol Negotiation) is available. That means ALPN is supported on:

All in all, it's a solid release. Go check out the announcement post on ASP.NET Core 2.2 for even more detail!


Sponsor: Preview the latest JetBrains Rider with its Assembly Explorer, Git Submodules, SQL language injections, integrated performance profiler and more advanced Unity support.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
December 16, 2018 15:16
This is awesome... seamless upgrade is a plus... will definitely upgrade once released... the only downside is it requires Visual Studio to be upgraded as well... that means the entire team members have to upgrade their IDE.
December 17, 2018 11:54
Great post, for Http/2 did you have to add a certificate? After looking at various examples it seems you need a .pfx for this to work in kestrel? When I create a new MVC application using the visual studio templates, Http/2 isn't on by default. Am I missing something?
December 17, 2018 12:00
Can you do an article on any performance improvements to full fat .NET framework, or is MS just giving up on that for the web side of things now .NET Core is out?
December 17, 2018 14:37
You did a great job with Microsoft Connect demo. Please share your theme for vscode I wanted to have it. It's really looking cool.
December 17, 2018 18:22
Scott,

What's your thoughts on using ASP.Net Core for intranet apps? We develop about a dozen apps here for intranet use only. Part of me would like to use Docker and Core... but we are a Windows only environment, with Windows servers.
December 17, 2018 20:12
I've had some issues with an we developed initially on .NET Core 2.0 and actually haven't got around to upgrading to 2.1 yet. Guess I'll skip to 2.2 when I get the "go ahead". I wonder how much of our particular issue will be remedied or sidestepped by the IIS in-proc?

The skinny of it is that certain operations are fairly intensive so we can only support a certain number of concurrent calls and queue size before the site gets too bogged down (think the first few hours of any Steam sale). Anything we tried on the IIS side to munge with the queue and throttling requests didn't seem to be applicable (likely due to IIS 7 and integrated mode changes) but aside from the Kestrel limits themselves we couldn't figure out how to actually set up a queue. It was either "we can handle 'x' calls or we'll 503 ya!"

For better or worse we ended up implementing Tomasz Pęczek's "experimental" throttler on top of making some other changes to our overall pipeline (more/better async/await handling, caching some of the heavy calls, etc) and that at least got us to a stable spot.

Anyway, looking forward to trying it out and now that we're out of the fire I can spend some time researching the IIS to .NET Core proxy and see if I can figure the queue/throttling stuff out directly instead of using the bandaid.
December 18, 2018 12:39
Guess I'll skip to 2.2 when I get the "go ahead". I wonder how much of our particular issue will be remedied or sidestepped by the IIS in-proc? The skinny of it is that certain operations are fairly intensive so we can only support a certain number of concurrent calls and queue size before the site gets too bogged down (think the first few hours of any Steam sale). Anything we tried on the IIS side to munge with the queue and throttling requests didn't seem to be applicable (likely due to IIS 7 and integrated mode changes) but aside from the Kestrel limits themselves we couldn't figure out how to actually set up a queue.
December 21, 2018 23:13
That's the "Andromeda" theme, Jalpesh!
December 22, 2018 6:34
Does Kestral exist? :-p

I think you meant Kestrel. Anyway, I'm looking at these new feature from 2.2 right now.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.