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

document what the server's ServeHTTP is missing compared to the Serve method #2662

Closed
nhooyr opened this issue Feb 28, 2019 · 3 comments
Closed

Comments

@nhooyr
Copy link

nhooyr commented Feb 28, 2019

https://godoc.org/google.golang.org/grpc#Server.ServeHTTP

Note that ServeHTTP uses Go's HTTP/2 server implementation which is totally separate from grpc-go's HTTP/2 server. Performance and features may vary between the two paths. ServeHTTP does not support some gRPC features available through grpc-go's HTTP/2 server, and it is currently EXPERIMENTAL and subject to change.

What precisely are the differences?

@dfawley
Copy link
Member

dfawley commented Mar 1, 2019

There are a number of differences; too many to document in the godoc comment. Here are the ones I can think of right now:

  • Keepalive pings and server enforcement of client keepalive pings
  • Max idleness detection
  • Connection-level stats handlers
  • InTapHandle (called before handling a new stream to potentially kill it before allocating any resources for it)

In addition, it is not a feature actively maintained by the grpc-go team; I would avoid using it.

@dfawley dfawley closed this as completed Mar 1, 2019
@ronnylt
Copy link

ronnylt commented Apr 2, 2019

In addition, it is not a feature actively maintained by the grpc-go team; I would avoid using it.

@dfawley is there any other way of sharing the same port (such as 443 for https) between gRPC and an existing http.Handler?

I would like to follow your advice of avoid using it, mainly if it's a feature actively maintained by the grpc-go team.

Thanks

@dfawley
Copy link
Member

dfawley commented Apr 2, 2019

You could use something like cmux for server-side port sharing. This will delegate the whole Conn over to gRPC after the headers are sent by the client, and then go through the grpc-go HTTP/2 transport. (Note that you will need the "workaround" for Java since grpc-go v1.18 [ref] and PR to update their docs.)

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants