The gRPC service can use on HTTP/3 connection. This article describes how the gRPC connection affects HTTP connection, additionally, history of HTTP connection is also described.

>>Rust sample project to create QR Code, Base program of implantation to Azure Functions

• History of HTTP connection

Internet Engineering Task Force (IETF) has proceeding technical standardization of internet. HTTP working group of IETF treats HTTP semantics, caching, and HTTP messaging. HTTP messaging uses the same semantics of HTTP/1.1, HTTP/2 and HTTP/3.

Therefor RFC 9113 (HTTP/2 bis), RFC 9114 (HTTP/3) and RFC9204 (QPACK) affects to the gRPC connection although, Google and many technicians have contributing to the gRPC connection since April 2016 (when Google’s the Stubby was opened as the gRPC 1.0). Afterwards the [gRPC over HTTP2] since 2015, and the [gRPC over HTTP/3] since 2021 are opened on GitHub. There are standardised considering with the standard of IFTF.

To simply say about only HTTP messaging, it has been improved as HTTP 0.9 (since 1990) – 1.0 (1996: POST etc.) – 1.1 (1997: Virtual host etc.) – 2.0 (2015: Stream) – 3.0 (2018: UDP communication).

Evolution of HTTP messaging can explain with an aspect of connection and an aspect of data.

As an aspect of connection, a setting of connection is shared between edge-side and service-side on streaming communication of HTTP/2, as result, edge-side can start next request without waiting for the end of before request.

As an aspect of data, the headers of HTTP/2 are compressed, and a content is communicated as binary. Thus, reduces workload of adding new connections because one connection can handle many requests.

HTTP/3 reduces the communication initiation cost and transport layer confirmation response cost. And using UDP connection, it performs high-speed data transmission and reception.

• QUIC library for development of the gRPC connection

Microsoft provides MsQuic that is implementation of IETF’s QUIC as library. This library is standard on Windows, thus provided API on over .NET 7.0. Though this library does TLS handshake, it is also provided Windows 11 build 22000 or later as Windows SChannel.

Therefore does not use MsQuic explicitly on Windows 11 and .NET 7.0.

There are other libraries for other languages for Quic connection such as below table.

C++
QUICHE
Rust
quinn
C, Rust
MsQuic
C
LSQUIC
Python
aioquic
Rust
s2n-quic
Go
quic-go
Rust
Neqo

Implementation of gRPC over HTTP/3 is easy as below code that modified from the ‘Program.cs’ of the ‘GrpcGreeter’ folder of this sample.

builder.WebHost.ConfigureKestrel(options =>
{
    options.ListenAnyIP(5008);
    options.ListenAnyIP(7116, listenOptions =>
    {
        // listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http2;
        // listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http1AndHttp2AndHttp3;
        listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http3;// add only this line
        listenOptions.UseHttps(options =>
            {
                options.ClientCertificateMode = ClientCertificateMode.RequireCertificate;
                options.ClientCertificateValidation = (certificate, chain, errors) => {
                    options.ServerCertificate = certificate;
                    return true;
                };
            }
        );
    });
});

Categories:

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *