For the .NET Core 2.2 application deployed on a single AWS EC2 host I am comparing IIS hosting vs plain Kestrel hosting.
For IIS configuration I followed MS documentation.
For Kestrel I simply used:
dotnet app.dll --server.urls http://*:5000
I am running "stress" test with JMeter in order to compare throughput. This test is simply calling app's endpoint with 100 threads for 10 seconds duration (5 seconds warmup). Note, that endpoint is basically getting same data from MSSQL Server database on each call, no caching etc.
As a result, Kestrel fails 75% of requests with socket closed/timeout errors:
QUESTION: What kind of configuration error can lead to such Kestrel behavior? I've tried to use a basic nginx reverse proxy in front of Kestrel, but still getting the same results.
It turned out, that described behavior occurs when testing the performance of synchronous endpoint.
By following Thread injection algorithm, CLR will have only minWorkerThreads/minIoThreads to process requests and since "stress" test uses more threads than created at the moment we wait for new threads - which leads to almost linear growth of response time.
Switching to asynchronous eliminates the difference in performance, see:
References:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With