Is there a way to verify if HTTP2 or HTTP1.1 is in use?

365 views
Skip to first unread message

Keith Rosenberg

unread,
Mar 4, 2021, 5:42:00 PM3/4/21
to grpc.io
I am using a C++ server, and a C++ client and JS client, where I have it operational both with InsecureCredentials and with Secure Credentials using a self-signed cert. I read in some documentation that when you use InsecureCredentials, gRPC uses HTTP1.1 instead of HTTP2, because HTTP2 requires SSL. However, when I try to get logs out of the server, the output looks very much the same - is there any way to confirm whether traffic is going over HTTP1.1 or 2?
I have experimented with some flags like
```
GRPC_VERBOSITY=debug GRPC_TRACE=http,http1,http2_stream_state,secure_endpoint
```
When I run with InsecureCredentials, I still see a lot of logs from http2_stream_state, but I would imagine that this doesn't imply that HTTP2 is being used, instead it means that it is just going though the same route in the code.

I am trying to determine the performance difference (if any) between the usage of the two protocols (if any), but I do not feel comfortable reporting performance without being 100% sure which protocol it is using. 

I was hopeful that I might find the answer in some of the environment variable here: https://github.com/grpc/grpc/blob/master/doc/environment_variables.md#grpc-environment-variables but the logs look largely the same either way, except for some secure_endpoint calls, which really just imply HTTPS and encryption are being utilized, but do not clearly show which protocol is utilized.

Thanks a ton!
Keith

Menghan Li

unread,
Mar 17, 2021, 1:16:31 PM3/17/21
to grpc.io
gRPC only support HTTP2, no matter with or without security.

> I am using a C++ server, and a C++ client and JS client,

Which JS client are you referring to? Is it Node client? Or JS from browser? 

JS from browser would be gRPC-web, it's wire format is different from gRPC over HTTP2, see more details at: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md#protocol-differences-vs-grpc-over-http2

Reply all
Reply to author
Forward
0 new messages