IIS vs Kestrel performance comparison

前端 未结 5 1348
清酒与你
清酒与你 2020-12-15 17:27

How does the performance of IIS look like comparing to a Kestrel http server?

Seems like Kestrel is significantly inspired by the family of asynchronous and event-dr

相关标签:
5条回答
  • 2020-12-15 17:46

    I did quite a bit of benchmarking for my current project, hosting both .net core 1.0 and 2.0 apps on IIS and Kestrel. The tests were real-world rest-api CRUDs with authentication/authorization, logging, metrics, rate limiting etc. Also, .net core apps were done completely by the MS book, complying to recommended 1.0/2.0 standards.

    With the same hardware setups, hosting behind IIS constantly served around 40% more requests per second. I'm still unable to find an article or a consultant who is able to explain the performance difference.

    I also tried to find any sort of optimization tips from the core benchmarking authority https://github.com/aspnet/benchmarks, by rummaging through settings and service initializers, but still, IIS was just faster.

    Any pointers?

    0 讨论(0)
  • 2020-12-15 17:46

    As of Nov 2016, straight from the ASP.NET benchmarks.

    On Windows Server 2012, at a pipeline depth of 16:

    stack        on       RT        requests/sec
    ASP.NET 4.6  IIS      CLR           57,792 
    ASP.NET 5    Kestrel  CoreCLR    1,188,521       
    

    That's a 20x or 2000% speedup. I understand a full blown IIS vs standalong Kestrel but I do hope someone on the ASP.NET team can deep dive on this because the difference is tremendous.

    That and why it's so much slower on Linux.

    0 讨论(0)
  • 2020-12-15 17:52

    Here are some preliminary Kestrel benchmarks by the asp.net team. While not as exhaustive as what you were looking for you will find they post some information regarding RPS. I'm sure more will come as they get closer to a release. IIS benchmarks you can find on the internet with a simple google search:

    https://github.com/aspnet/benchmarks

    0 讨论(0)
  • 2020-12-15 17:59

    As for why in-process hosting in IIS is faster (taken straight from the docs):

    Using in-process hosting, an ASP.NET Core app runs in the same process as its IIS worker process. In-process hosting provides improved performance over out-of-process hosting because requests aren't proxied over the loopback adapter, a network interface that returns outgoing network traffic back to the same machine.

    See Hosting Models.

    0 讨论(0)
  • 2020-12-15 18:00

    Here is the XSLX file from the GitHub repo where you can see the performance comparisson you are looking for.

    Open the file on Excel and check the "Latest" tab.

    Update: The excel file is no longer available and has been replaced with an interactive Power BI dashboard.

    0 讨论(0)
提交回复
热议问题