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

G2: gRPC over HTTP/3 #256

Merged
merged 9 commits into from
Dec 20, 2021
Merged

G2: gRPC over HTTP/3 #256

merged 9 commits into from
Dec 20, 2021

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 25, 2021

A specification for gRPC over HTTP/3.

There is a lot of overlap with the content in https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md. For example, request and response headers are unchanged between HTTP/2 and HTTP/3. Rather than duplicate content, the proposal focuses on the differences between HTTP/2 and HTTP/3.

Preview: https://github.com/JamesNK/proposal/blob/jamesnk/http3/G2-http3-protocol.md

G2-http3-protocol.md Outdated Show resolved Hide resolved
G2-http3-protocol.md Outdated Show resolved Hide resolved
G2-http3-protocol.md Outdated Show resolved Hide resolved
ejona86 added a commit to ejona86/grpc that referenced this pull request Sep 1, 2021
It was revealed during the [HTTP/3 gRFC discussion][1] that servers
using RST_STREAM for deadlines and the client-side trick of
double-checking the deadline when processing CANCELLED status wasn't
documented.

I'm not all that bothered if an implementation uses Trailers instead of
RST_STREAM for deadline, but it does seem hard for an implementation to
avoid truncating a message in that situation and it may extend the
amount of time the RPC consumes memory.

[1]: grpc/proposal#256
G2-http3-protocol.md Outdated Show resolved Hide resolved
G2-http3-protocol.md Outdated Show resolved Hide resolved
G2-http3-protocol.md Outdated Show resolved Hide resolved
A trial implementation in grpc-dotnet is underway. .NET 6 is adding preview support for
HTTP/3 to the .NET server and client. grpc-dotnet leverages that underlying HTTP/3 support.

## Open issues (if applicable)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUIC always uses security (TLS) which means gRPC-over-http3 always requires certs/keys IIUC. Does it impact the gRPC API or the usage? To be addressed in this gRFC?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP/3 would never be negotated over an insecure connection.

Scenarios would be:

  1. gRPC client uses prenegotated H2C over insecure connection
  2. gRPC client uses TLS and requests only HTTP/2. Ignores alt-svc header returned from the server.
  3. gRPC client uses TLS and requests HTTP/2 or greater. In this case an initial HTTP/2 call is made, server returns response with an alt-svc header that tells the client that HTTP/3 is available. HTTP/2 connection is replaced with QUIC+HTTP/3 and future calls use HTTP/3.
  4. gRPC client uses TLS and is configured in advance to only do HTTP/3. QUIC+HTTP/3 connection is made to server.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clients might introduce channel settings to give users the specify what protocol they want. For example:

  • RequestVersion with 2.0, 3.0.
  • RequestVersionPolicy with RequestVersionExact, RequestVersionOrGreater (allow upgrade)

@larspaulsen
Copy link

Hi James,

Do you happen to know how gRPC Servers or Client e.g. SDK kind of pluming/wrapper code get notified of transport errors for any of the following types of streaming gRPC connections (service interface call/functions), other than implementing their own heartbeat timeout mechanism?:

  1. Server Streaming.
  2. Client Streaming.
  3. Bi-directional Streaming.

?

Thank you,

-lars

## Implementation

A trial implementation in grpc-dotnet is underway. .NET 6 is adding preview support for
HTTP/3 to the .NET server and client. grpc-dotnet leverages that underlying HTTP/3 support.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lidizheng what about doing some python asyncio prototyping!? https://github.com/aiortc/aioquic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that building a MVP gRPC Python HTTP/3 on top of the aioquic library probably isn't that hard. Currently, gRPC Python uses gRPC Core as the transport layer, it's not that trivial to move existing code onto another transport library. I hope if we want to invest resources, we have a working architecture and aiming for long-term support.

@ejona86
Copy link
Member

ejona86 commented Dec 15, 2021

@JamesNK, is there anything in this PR you'd like to change before I merge it? It looks like there's only one typo to address from my perspective.

G2-http3-protocol.md Outdated Show resolved Hide resolved
@JamesNK
Copy link
Member Author

JamesNK commented Dec 17, 2021

@JamesNK, is there anything in this PR you'd like to change before I merge it? It looks like there's only one typo to address from my perspective.

Fixed typo. I also added a section on HTTP/3 negotiation in reply to @sanjaypujare's comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants