Simple test project optimized for Hello World style controller ops for comparison of hosting options on Windows
The goal of this project isn't to come up with hard performance numbers but rather to compare different hosting solutions.
Specifically I use this to compare performance between using raw Kestrel vs. using IIS for InProcess and OutOfProcess hosting.
You can find out more about the hows and why's in this blog post:
This is very simple project that essentially contains a bunch of do-nothing HelloWorld examples. These examples are meant to merely test framework throughput - in this case to a base controller.
Again this isn't meant to check performance per se, but rather compare performance between different hosting environments.
This project has a few simple endpoints set up:
api/helloworld
- plain text outputapi/helloworldJson
- JSON object outputapi/helloworldpost
- post a person objectwebsurge-allow.txt
- 2 byte static fileThere are test set up for West Wind Web Surge in perftest.websurge
. You can open this file in WebSurge or potentially import the requests into another load tester of your choice - .websurge
files are plain text and use Fiddler's HTTP text formatting so it should be easy to set up requests.
You can pick up a trial version of WebSurge from the Web site and open the perftest.websurge
file which is the easiest to duplicate these example, but feel free to use any other load testing tool.
For testing in WebSurge I test each request individually rather than all together:
To do this select the request you want to test and press Ctrl-I
to toggle between active and inactive (italic) state. You can move through various requests to test.
The test requests are set up for the default Kestrel http
port on localhost:5000
. To run tests:
dotnet publish -c Release
bin\release\netcore22\publish
dotnet perftest.dll
There are publish*.ps1
scripts for performing publish and run operations for Kestrel and IIS.
To use the same WebSurge tests for IIS you can use the Session Options and Replace Domain to set to a different domain.
I created a local perf.west-wind.com
site, added a hosts entry and then changed Replace Domain to perf.west-wind.com
which then hits my IIS server.
You can switch between IIS InProcess and OutOfProcess hosting by change the project's AspnetCoreHostingModel
setting to InProcess
or removing the key.
<AspnetCoreHostingModel>InProcess</AspnetCoreHostingModel>
There are Powershell scripts for publishing and running the servers locally, both with Kestrel and IIS.
Testing on a local Windows machine is not a precise science due to all the crap that tends to be running on desktop machines. You'll want to minimize what's running on your machine to get semi-consistent results.
Some of the important things to check:
Before you run you checks check task manager to see whether some crazy background task like background indexing or recompilation of .NET Framework ngen assemblies is happening. If it is - wait for that to finish :-)
Yeah - inexact, but the point isn't how fast, but rather comparing between different appproaches.
The static file test on IIS is a good baseline for stability and system perf overall as that seems to stay fairly steady.