-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add inline scheduler option for Sockets transport #24638
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -44,6 +44,14 @@ public class SocketTransportOptions | |||||
|
||||||
public long? MaxWriteBufferSize { get; set; } = 64 * 1024; | ||||||
|
||||||
/// <summary> | ||||||
/// Inline application and transport continuations instead of dispatching to the threadpool. | ||||||
/// </summary> | ||||||
/// <remarks> | ||||||
/// This will run application code on the IO thread which is why this is unsafe. | ||||||
/// </remarks> | ||||||
public bool UnsafeInlineScheduling { get; set; } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RunOnTransportThread There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't sound unsafe enough! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UnsafeRunOnTransportThread! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the env variable in Runtime globally affects some settings and even if you use private reflection to set the per Socket setting you don't affect the other things the env variable does. This results in massive perf regressions, i.e. 100k RPS without the env variable but with private reflection vs. 1.2M RPS with the env variable and no private reflection. |
||||||
|
||||||
internal Func<MemoryPool<byte>> MemoryPoolFactory { get; set; } = System.Buffers.SlabMemoryPoolFactory.Create; | ||||||
} | ||||||
} |
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.
Explain how this can hurt your performance. Also document the
DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS
environment variable.