Nancy
Nancy copied to clipboard
SelfHost: Change to callback based responses for better performance
Prerequisites
- [X] I have written a descriptive pull-request title
- [X] I have verified that there are no overlapping pull-requests open
- [X] I have verified that I am following the Nancy code style guidelines
- [X] I have provided test coverage for my change (where applicable)
Description
I noticed that the SelfHost was not performing well when using async
methods. You can test a simple endpoint using await Task.Delay(100)
and see them queue up as the engine handle blocks waiting for the task. This change converts it to complete/error callbacks so they no longer block. Hope it helps, and please let me know if I missed anything! I'm new here :)
@khellang this is a PR sent tot he 1.x-WorkingBranch
@jocull 1.x
has been in maintenance mode for quite some time now and I'd rather see you sent this PR against master
But that overload isn't there in 2.0. We've moved everything over to async/await and Tasks.
I can try to check this out in 2.x - it may not be an issue in the new versions, but was an issue in the current stable.
@jocull yeah it would be great if you could check if it happens on master
/ latest nuget release
@thecodejunkie Alright, so here's what I turned up:
- The latest revision
master
is all good, it benchmarks just fine - The latest on pre-release on nuget
2.0.0-clinteastwood
has the same issue as1.4.4
(didn't investigate, it just benchmarks that way) - And of course, the latest stable on nuget
1.4.4
also has this problem, which is patched in this PR
Along the way I noticed that 2.0.0-clinteastwood
is very old, over a year, but no new pre-releases to nuget. Is there a roadmap somewhere that shows the 2.x plans?