-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Avoid double dispatch by default on HTTP.sys #44409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- This is a similar change to the one made in Kestrel's transport layer. We avoid double dispatching from one thread pool thread to another when we're not running inline. Since the windows thread pool dispatches by default, we can just use that same thread to start the execution of the request. As a result, we need to dispatch the next accept call before executing the request.
| _asyncAcceptContext = asyncAcceptContext; | ||
| _messagePump = messagePump; | ||
| _workerIndex = workerIndex; | ||
| _preferInlineScheduling = _messagePump._options.UnsafePreferInlineScheduling; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Is there a reason for a field for this flag? Everything else is pulled off _messagePump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid multiple layers of indirection per request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it a local in ExecuteAsync above the while?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That while loop lasts for a single iteration when things are being dispatched (the default scenario).
| _asyncAcceptContext = asyncAcceptContext; | ||
| _messagePump = messagePump; | ||
| _workerIndex = workerIndex; | ||
| _preferInlineScheduling = _messagePump._options.UnsafePreferInlineScheduling; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it a local in ExecuteAsync above the while?
This is the JsonHttpSys benchmark. Here is the crank command.
Results