-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[QUIC] Copy managed memory instead of pinning #72746
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCopies data into native memory instead of just pinning so that we can unblock the pending Note that this is draft to see if it helps, I'm pretty certain there are better ways to do this. Feel free to suggest anything. Also adds logging of S.N.Quic traces for server. Fixes #72739
|
/azp run runtime-libraries stress-http |
Azure Pipelines successfully started running 1 pipeline(s). |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCopies data into native memory instead of just pinning so that we can unblock the pending Note that this is draft to see if it helps, I'm pretty certain there are better ways to do this. Feel free to suggest anything. Also adds logging of S.N.Quic traces for server. Fixes #72739
|
{ | ||
_handles = new MemoryHandle[count]; | ||
FreeNativeMemory(); | ||
_buffers = (QUIC_BUFFER*)NativeMemory.Alloc((nuint)count, (nuint)sizeof(QUIC_BUFFER)); | ||
} | ||
|
||
_buffers = (QUIC_BUFFER*)NativeMemory.AllocZeroed((nuint)count, (nuint)sizeof(QUIC_BUFFER)); |
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.
Before this change, Reserve
allocated only if _buffers
was too small to hold all count
buffers. Now it allocates every time. Is it necessary? Is the previous _buffers
array deallocated?
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.
This is just wrong, it also needs to free in case it "reallocates". I'll fix it, thanks for catching this.
/azp run runtime-libraries stress-http |
Azure Pipelines successfully started running 1 pipeline(s). |
6e91d7e
to
6d54852
Compare
I don't see any perf impact of this change (whaaaat 🤯) (I haven't run extensive benchmarks though, only some of them) Some resultsGet 8K (10 threads): *no regression* (~11K RPS on aspnet-perf-win)
Get 8K (1000 threads): *no regression* (~25K RPS)
Post 8K (1000 threads): *no regression* (~26K RPS)
Get 1M (1000 threads): *no regression* (~310 RPS)
Post 1M (1000 threads): *no regression* (~240 RPS)
Post 1K 10-bytes-at-a-time (1000 threads): *no regression* (~4K RPS)
Post 1M 1K-at-a-time (100 threads): *no regression* (~220 RPS)
Note: perf runs were fixed for P.S.: I can see the additional copying being present on the traces (so it's not like I somehow failed in substituting the dll) -- it takes ~22% of the time for "Post 1M (1000 threads)" scenario. Still the results above sound extremely strange to me. |
If we're limited by msquic thread then I guess adding more work on user thread doesn't affect the overall result. Note that this change only frees one pointer on msquic thread, otherwise the copy happens within |
@ManickaP FYI we just discussed on a meeting that we want this change to be merged for now while we are working on a "proper" fix (which we might not have in time for 7.0) |
/azp run runtime-libraries stress-http |
Azure Pipelines successfully started running 1 pipeline(s). |
Stress failures are "Completed unexpectedly" from #72619 |
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
Copies data into native memory instead of just pinning so that we can unblock the pending
ValueTask
beforeSEND_COMPLETE
.Note that this is draft to see if it helps, I'm pretty certain there are better ways to do this. Feel free to suggest anything.
Also adds logging of S.N.Quic traces for server.
Contributes to #72739