Why GRPC uses HTTP2 instead of pure TCP?

Wei Wong

To my knowledge, building an RPC protocol based on TCP is more efficient than using HTTP2, which is designed primarily for web services and has additional overhead. What is the meaning of building another application layer protocol over an application layer protocol? Why does not GRPC build its protocol directly over TCP?

paxdiablo

Well, that depends on how you measure efficiency :-)

If you're willing to take raw TCP and consider the layering of extra facilities on top of it to be zero development cost then, yes, TCP would probably be more efficient. But they're not really zero cost since you have to develop and test them.

HTTP/2, on the other hand, provides some extra facilities (at true zero development cost) which may be useful to protocols sitting on top of it.

For example, it provides binary framing, header compression, multiplexing (in parallel) request/response groups on a single TCP session, and server push in cases where the server can ascertain client needs without extra requests coming in.

I know for a fact that gRPC uses header compression since I've seen the debug output with its hpack logging. I'm not sure if it uses the other things but, for performance, I suspect they'd be quite handy.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

why http2 use prioritization over stream instead of requests?

Why does Xamarin Android fails to send GRPC/Http2 requests?

Why does gRPC uses Length Prefixed Messages?

Why Puma listen on 'tcp://localhost:3000' instead of 'http://localhost:3000'

HTTP2 .Net Framework issues with gRPC

Why Angular uses XLIFF 1.2 instead of XLIFF 2?

Wrap tcp listener script so that it uses a sock file instead

Why Ubuntu uses eglibc instead of glibc?

Why does Typescript uses 'number' instead of int'?

What the difference between JSON RPC with HTTP2 vs grpc?

Yii2 Dynamic Relational Query Junction with Sort uses 2 queries instead of a JOIN, why?

When does a http2 TCP connection close?

Golang TCP server: how to write HTTP2 data

HTTP2 over AWS ELB under TCP Mode

HTTP2 client with a custom TCP read buffer

TCP sessions with gRPC

Access HTTP2 headers from a @grpc/grpc-js Handler

Restangular uses HTTP OPTIONS instead of GET

joomla BASE HREF uses HTTP instead of HTTPS

Start rails server with http protocol instead of TCP

Why ember-cli uses extend instead of create?

Why Python uses global variables instead of method parameters?

Why Rails 5 uses ApplicationRecord instead of ActiveRecord::Base?

Why the method uses Activator.CreateInstance instead of directly "new Class()"?

haskell quick sort, why the first let uses <= instead of <?

Why std::get uses template parameter instead of regular parameter?

Why "System.arraycopy" uses "Object" instead of "Object[]"?

Why Swift library uses "enum CommandLine" instead of "struct CommandLine"?

Why Collections.sort uses merge sort instead of quicksort?