Skip to content

SocketSender/Receiver: also Inline continuations on Windows#19394

Closed
tmds wants to merge 1 commit into
dotnet:masterfrom
tmds:inline_socketsender_receiver
Closed

SocketSender/Receiver: also Inline continuations on Windows#19394
tmds wants to merge 1 commit into
dotnet:masterfrom
tmds:inline_socketsender_receiver

Conversation

@tmds
Copy link
Copy Markdown
Member

@tmds tmds commented Feb 27, 2020

Some benchmarks we ran on Linux indicate this may be interesting on Windows.

cc @halter73 @davidfowl @sebastienros @adamsitnik

@ghost ghost added the area-servers label Feb 27, 2020
@analogrelay analogrelay added this to the 5.0.0-preview2 milestone Feb 28, 2020
@analogrelay
Copy link
Copy Markdown
Contributor

Triage: we do have some hunch that there's a reason we didn't inline continuations on Windows. @davidfowl @halter73 does that ring a bell?

@davidfowl
Copy link
Copy Markdown
Member

@halter73 wrote up the reason we use IOQueues here dotnet/runtime#2346 (comment).

@tmds
Copy link
Copy Markdown
Member Author

tmds commented Mar 2, 2020

In theory, Inline should be faster than IOQueue, and IOQueue should be faster than ThreadPool.
In practice, it doesn't seem to always work that way.
So let's measure and see the effect.

@tmds
Copy link
Copy Markdown
Member Author

tmds commented Mar 6, 2020

Can we run a benchmark to see the effect?

@shirhatti
Copy link
Copy Markdown
Contributor

Triage: We've tried this before, and it didn't end well aspnet/KestrelHttpServer#2573

@shirhatti shirhatti closed this Apr 10, 2020
@tmds
Copy link
Copy Markdown
Member Author

tmds commented Apr 10, 2020

Triage: We've tried this before, and it didn't end well aspnet/KestrelHttpServer#2573

@shirhatti that issue says it didn't end well on Linux.

@shirhatti
Copy link
Copy Markdown
Contributor

Ah shoot @halter73?

@shirhatti shirhatti reopened this Apr 10, 2020
@tmds
Copy link
Copy Markdown
Member Author

tmds commented Apr 10, 2020

@halter73 if you know it is faster to use IoQueue here on Windows, I'm fine if the issue gets closed. Otherwise we can run a benchmark and find out.

@halter73
Copy link
Copy Markdown
Member

halter73 commented Apr 10, 2020

For SocketReceiver at least, dispatching receive continuations on Windows, even to the threadpool significantly improved perf in the plaintext and json benchmarks. @davidfowl first proved that with aspnet/KestrelHttpServer#2366.

Dispatching to the IOQueue which was introduced by aspnet/KestrelHttpServer#2368 showed even further improvement compared to dispatching to the threadpool. You can look at both PRs for the benchmark results we got at the time on Windows.

For the SocketSender, the difference was within the noise level IIRC, but that makes sense since sends should always complete immediately when there's no backpressure like in the plaintext and json benchmarks.

@halter73 halter73 closed this Apr 13, 2020
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants