Skip to content

Comment on Lessons Learned while Converting from ASP.NET to .NET Core

Comments

"As part of .NET Core, Microsoft (and the community) has created a whole new web server called Kestrel. The goal behind it has been to make it as lean, mean, and fast as possible. IIS is awesome but comes with a very dated pipeline model and carries a lot of bloat and weight with it. In some benchmarks, I have seen Kestrel handle up to 20x more requests per second. Yowzers!"

So the new Microsoft web server replacing IIS, Kestrel, is 20x faster in some circumstances? Wasn't IIS "state of the art"?

It isn't replacing IIS, and they're very clear that you almost certainly shouldn't be exposing Kestrel to the internet without going through something like nginx or IIS.

Kestrel does the bare basics of a web server, it goes a little bit further than the dev servers built into plenty of other language's web frameworks.

very clear that you almost certainly shouldn't be exposing Kestrel to the internet without going through something like nginx or IIS.

Why is that? Will you still have the performance benefit of Kestrel if you use IIS in front of it? How would that work?

The same reasons that Python, Ruby, and Node are almost always reverse-proxied by a "bigger" web server. The "closer to the metal" server handles things like virtual hosts, load balancing, black lists/white lists, throttling, speaking to the kernel-layer about low level IP port specifics, while the "closer to the language" server deals with the realities of your business logic and application code.

That separation of concerns between two web servers in a reverse-proxy has become a very useful mainstay "Production best practice" in the Linux/Unix world, so it's nice to see Kestrel follow the larger trends there. It makes it easier to use Kestrel in most Linux/Unix deployments, but some of the reasons that it became best practice apply back to Windows. For instance, the principal of least privilege applies in that the application web server can run in a much more isolated process space than the kernel-level web server and the service boundary to secure between them in a reverse-proxy scenario is "just HTTP".

As for performance, IIS is a rather good reverse proxy and efforts to make it better for Kestrel have benefited Node, Python, and Ruby hosting on Windows, as well as vice versa.

IIS running your web app is kinda slow, because the request has to be pumped through a long, old and rusty pipeline.

IIS as a reverse proxy in front of kestrel should be very fast.

Wasn't IIS "state of the art"?

AFAIK even venerable Apache performed better than IIS, and Apache is not the fastest web server out there.

Sure, it was irony ;-)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.