Skip to content
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

x/net/http2: support sendfile optimization #18204

Closed
nhooyr opened this issue Dec 6, 2016 · 1 comment
Closed

x/net/http2: support sendfile optimization #18204

nhooyr opened this issue Dec 6, 2016 · 1 comment

Comments

@nhooyr
Copy link
Contributor

nhooyr commented Dec 6, 2016

It doesn't look like the http2 response writer supports the sendfile optimization that the http/1.x one does as it does not implement the ReadFrom method.

This method is what I am talking about:

// ReadFrom is here to optimize copying from an *os.File regular file

@bradfitz
Copy link
Contributor

bradfitz commented Dec 6, 2016

This isn't really relevant for http2.

http2 is basically always over TLS (at least for common browsers, and for Go), where sendfile doesn't work.

But even if you used golang.org/x/net/http2 directly to implement h2c (cleartext http2), http2 has framing boundaries and a 16KB or so frame boundary, so you'd need to do many repeated small sendfile calls, which are much less beneficial.

So, closing this as not applicable.

@bradfitz bradfitz closed this as completed Dec 6, 2016
@golang golang locked and limited conversation to collaborators Dec 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants