-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Add SocketTransportOption to enable/disable WaitForData #19396
Conversation
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.
LGTM.
I confirm that making this optional can improve throughput and latency. Moreover, it's mandatory to make batching with Linux AIO work (it does not support 0 bytes reads)
src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs
Outdated
Show resolved
Hide resolved
Co-Authored-By: Adam Sitnik <adam.sitnik@gmail.com>
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.
The ref assemblies need updating.
https://github.com/dotnet/aspnetcore/blob/master/docs/ReferenceAssemblies.md
What are the actual benchmark numbers?
@@ -16,6 +16,14 @@ public class SocketTransportOptions | |||
/// </remarks> | |||
public int IOQueueCount { get; set; } = Math.Min(Environment.ProcessorCount, 16); | |||
|
|||
/// <summary> | |||
/// Wait until there is data available to allocate a buffer. Set this to true to reduce memory used for idle connections. |
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.
Setting this to false can increase throughput at the cost of increased memory usage.
Can we run a benchmark using the Citrine infrastructure? Should I make a change to some files to make the benchmark run with |
/azp run pr-benchmark |
No pipelines are associated with this pull request. |
FYI, this will need API review (should be quick and easy though) as it adds a new public API. |
I set the default to |
Benchmark results using Citrine: JSON WaitForData enabled: --jobs "..\Benchmarks\benchmarks.json.json" --scenario "Json"
WaitForData disabled: --jobs "..\Benchmarks\benchmarks.json.json" --scenario "Json"
For Plaintext there is no visible difference - both settings give me 86XYk RPS |
Did you set --self-contained on both runs, or use a custom build on each run to ensure that self-contained is implicitly set? If not then the displayed versions are misleading as the sdk's shared runtimes would prevail. |
@sebastienros For the disabled case, I've compiled this dll locally and sent it using |
In the case you don't provide any argument then you need to use |
src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs
Outdated
Show resolved
Hide resolved
@sebastienros @halter73 where can we set |
I guess it is in https://github.com/aspnet/Benchmarks once this change has rippled through. |
Normally our API reviews are on Monday, but it got canceled this week. I'll try to get it through next Monday. Sorry for the delay. |
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
If the goal is only for benchmarking, you can do a local build that would use an ENV, or hard code the switch, and share the lib to use it instead. |
This got approved via email, so no need to wait 😄 Thanks! |
As follow up to this call |
This allows to opt-out of the zero-byte read that is performed to reduce memory usage for idle connections.
This read has a measurable impact on TE JSON benchmark.
cc @halter73 @davidfowl @sebastienros @adamsitnik