Basic Concepts
-
gRPC
is a rpc(protocol) framework. -
Protocol Buffer
is serialization mechanism supported by-
IDL(Interface Definition Language)
to write.proto file
(scheme file) with -
protoc(protocol buffer compiler)
which can autogenerate client code & server code - Libraries which is used with afformentioned autogenerated scripts
-
Steps to use gRPC
- Write
.proto file
- with IDL
- Autogenerate client code & server code with
$grpc-gen-grpc
(, which isprotoc
command for ruby). This creates 2 files, which are-
xxx_pb.rb
(Request class
andResponse class
are defined) -
xxx_services_pb.rb
(Service class
andStub class
are defined)
-
- Implement
server script
(Server class
should implemented here)&
client script (which uses Stub class)` and boot them.
Technologies behind gRPC
Protocol Buffers
- As is mentinoned, this is composed of
lang + compiler + libraries
. - For ruby, compiler command is
protoc-gen-grpc
which provides:- plugin to autogenerate message class
- plugin to autogenerate service class
- Its binary format is compact and quickly (de)serializable.
HTTP/2
- Stems from SPDY from Google. Transport is totally updated from HTTP/1.1
- Main functionalities are:
- Multiplexing(多重化) which enables parallel responding (by multiple streams).
- Header Compression(ヘッダ圧縮) by HPACK. (Originally in HTTP/1, header was 500-800 bytes)
Top comments (0)