-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Consider letting the transport own the creation of IDuplexPipe #4752
Comments
Probably it also means removing I assume existing implementations can just create the two Pipes similar to how Kestrel does it now, and things will work as before. |
Not necessarily, the application callback (process request) could still be dispatched by kestrel itself.
That's correct. |
Ah, ok. I see the default is to use the ThreadPool: So Sockets are doing a double dispatch currently. |
Yep. That's why we were surprised that it was helpful to dispatch in SocketAsyncEventArgs.Completed on Windows. |
@halter73 I didn't realize Windows also did a threadpool dispatch on Windows. When you benchmark Sockets with |
It doesn't, we dispatch and it performs much better than running inline |
@davidfowl are you sure? In corefx I see the iocp stuff is using |
I'm sure we dispatch ourselves on Windows in SocketAwaitable.Complete(). ThreadPoolBoundHandle uses the ThreadPool to handle GetQueuedCompletionStatus on completion port threads, but I don't see anywhere it dispatches to worker threads on its own. |
ok, I don't understand iocp and I believe you when you say it doesn't run on the ThreadPool 😄 |
@davidfowl are you going to be working on this? If not, please punt. Thanks. |
Acceptance checklist (check one item)
|
We changed the design such that the pipes are owned by the transport as part of #10308 |
Today the transport is responsible for exposing properties on the connection that can be used by Kestrel to create a duplex pipe. It does this today for a few reasons:
Delegating to the transport has some other benefits:
To make this change though, we need to pass the relevant settings from kestrel to the transport without coupling. My current though is to pass a settings object to ITransportFactory.Create.
See https://github.com/geoffkizer/KestrelHttpServer/blob/7bd21cdb1581fc3559479842262a24deecf171bb/src/Kestrel.Transport.Sockets/Internal/SocketConnection.cs for an example of the socket transport with a direct pipe implementation.
/cc @tmds @benaadams (only other people that wrote transports 😄)
The text was updated successfully, but these errors were encountered: