Search code examples
performance.net-corekestrel

.NET COre kestrel failed request handling performance


I'm doing some performance tests and I see that there is problem to handle unauthorized requests, I use authorization filter which check JWT from header and it's very simple to raise CPU usage to 100% with just 100 requests per second, performance profiler shows that most of the time is used by DefaultFilesMiddleware, actual validation takes only 5% of request execution time.

The application runs as a standalone console application.

Can I improve performance somehow or maybe there is good guide how to setup?


Solution

  • looks like there is nothing wrong with performance, inside authorization filter i replaced throw new exception() with context.Result = new UnauthorizedResult(); and disabled console logging as it affects performance too much, so now it can handle on my laptop 10 000+ requests per second