Nancy icon indicating copy to clipboard operation
Nancy copied to clipboard

SelfHost: Change to callback based responses for better performance

Open jocull opened this issue 7 years ago • 6 comments

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 :)

jocull avatar Jan 05 '18 23:01 jocull

CLA assistant check
All CLA requirements met.

dnfclas avatar Jan 05 '18 23:01 dnfclas

@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

thecodejunkie avatar Jan 06 '18 11:01 thecodejunkie

But that overload isn't there in 2.0. We've moved everything over to async/await and Tasks.

khellang avatar Jan 06 '18 12:01 khellang

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 avatar Jan 06 '18 18:01 jocull

@jocull yeah it would be great if you could check if it happens on master / latest nuget release

thecodejunkie avatar Jan 07 '18 13:01 thecodejunkie

@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 as 1.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?

jocull avatar Jan 08 '18 19:01 jocull