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
net: support zero-copy send on TCPConn when reading from File via SectionReader #61727
Comments
In principle this sounds good but in practice I think this will require exporting some fields from |
@ianlancetaylor would a linkname-d unexported method be acceptable? That would sidestep the proposal process... (that we can still do if we want, but at least without blocking this) |
Honestly I don't think this problem is important enough or urgent enough to reach for |
@ianlancetaylor personally I feel the urgency a bit more, but OK, understood. I don't really have a strong opinion about which way to go for the proposal, and it's not like the rest of package
(all names above are placeholders, feel free to suggest different ones) Will take your preference and prepare the proposal based on it. |
I don't see a problem with exporting the |
Change https://go.dev/cl/526855 mentions this issue: |
Fixes: golang#61870 Updates: golang#61727 Change-Id: Iaef9b59c402d68f6bf64be212db2b6746abe8900
Early results for sending a 1MB file:
|
Fixes: golang#61870 Updates: golang#61727 Change-Id: Iaef9b59c402d68f6bf64be212db2b6746abe8900
goos: linux goarch: amd64 pkg: test cpu: Intel(R) Xeon(R) CPU @ 2.20GHz │ master.txt │ patch.txt │ │ sec/op │ sec/op vs base │ Serve-4 466.5µ ± 3% 268.5µ ± 5% -42.43% (p=0.000 n=10) │ master.txt │ patch.txt │ │ B/op │ B/op vs base │ Serve-4 52.331Ki ± 3% 8.423Ki ± 26% -83.90% (p=0.000 n=10) │ master.txt │ patch.txt │ │ allocs/op │ allocs/op vs base │ Serve-4 152.00 ± 7% 87.50 ± 10% -42.43% (p=0.000 n=10) Updates golang#61727 Change-Id: Iede44e82cf56af81d75f4c5a024cb8a6d3dc5116
DO NOT REVIEW DO NOT SUBMIT goos: linux goarch: amd64 pkg: test cpu: Intel(R) Xeon(R) CPU @ 2.20GHz │ master.txt │ patch.txt │ │ sec/op │ sec/op vs base │ Serve-4 466.5µ ± 3% 268.5µ ± 5% -42.43% (p=0.000 n=10) │ master.txt │ patch.txt │ │ B/op │ B/op vs base │ Serve-4 52.331Ki ± 3% 8.423Ki ± 26% -83.90% (p=0.000 n=10) │ master.txt │ patch.txt │ │ allocs/op │ allocs/op vs base │ Serve-4 152.00 ± 7% 87.50 ± 10% -42.43% (p=0.000 n=10) Updates golang#61727 Change-Id: Iede44e82cf56af81d75f4c5a024cb8a6d3dc5116
Change https://go.dev/cl/527215 mentions this issue: |
Fixes #61870 Updates #61727 Change-Id: Iaef9b59c402d68f6bf64be212db2b6746abe8900 Reviewed-on: https://go-review.googlesource.com/c/go/+/526855 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Fixes golang#61870 Updates golang#61727 Change-Id: Iaef9b59c402d68f6bf64be212db2b6746abe8900 Reviewed-on: https://go-review.googlesource.com/c/go/+/526855 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Currently
net.TCPConn
has dedicated support for this, but only forLimitedReader
. Having dedicated support also forSectionReader
would allow using the same FD concurrently to send the same file to multiple TCP connections, as well as supporting other use-cases (e.g. range requests).This is obviously currently possible but without zero-copy support, resulting in the fallback
genericReadFrom
being used (that, in addition to requiring more syscalls, also requires more allocations):I have a PoC for this on deea4f6
The text was updated successfully, but these errors were encountered: