service mesh , , service mesh .
, service mesh . , . Representational State Transfer (REST) Remote Procedure Call (gRPC) , , gRPC.
RESTful gRPC
, Google Kubernetes Engine (GKE), , , -:
, , . , X, N , N , , . , 1, RESTful , HTTP/1.1.
, , . , gRPC, , , ( HTTP/2 Linkerd) gRPC.
, REST API, gRPC. 2 , REST gRPC. , , API gRPC.
, gRPC , , . gRPC gRPC. , gRPC, , , .
gRPC?
WePay REST JSON. REST :
JSON- .
REST-.
REST — , .
, REST:
, 1, X, X, , .
REST- SSL handshake. .
, API.
JSON — , .
, gRPC .
gRPC , , .
gRPC:
RPC-, gRPC , .
.
Protocol Buffers, JSON.
, .
Protobuf
Protobufs — ".proto", . , . , .
1. gRPC- HelloWorld RPC- "SayHello".
Protobufs / . JSON. , , JSON- .
protobuf-, proto- . , "" , 1, Java, :
, RPC-.
2. HelloWorld Java,
(), .
3. HelloWorld Java-
, .
4. Java protobuf-
gRPC HTTP/2. HTTP/2 , . gRPC (channel) (call). , gRPC , REST.
REST gRPC?
, REST- gRPC. . gRPC grpc-gateway -, RESTful JSON API gRPC. gRPC protobufs -.
gRPC:
.
.
REST, gRPC gRPC. , REST, .
gRPC- , REST-. , REST- , . gRPC- .
gRPC- REST-.
, . , RPC- gRPC-. "GrpcServerBuilder", :
"" (interceptor) , /, . .
, RPC- .
GrpcServerBuilder gRPC-. .
Service Mesh
Linkerd service mesh WePay, Linkerd HTTP/2 gRPC. gRPC- Kubernetes . service mesh REST- , Kubernetes, (path). , Kubernetes "foo", Linkerd , "foo/".
gRPC HTTP/2. gRPC- — "path". Path :
<package_name>.<grpc_service_name>/<method_name>
Kubernetes gRPC. , Kubernetes "greeter", gRPC- "GreeterService".
, gRPC, gRPC-. , gRPC- gRPC- .
(path) . , "service" Kubernetes Linkerd "service" gRPC.
, , Kubernetes. Linkerd .
CI/CD gRPC-
gRPC- :
, protobufs.
protobuf-, .
().
:
protobuf-?
?
proto-, , ?
, gRPC-.
WePay - (Service Oriented Architecture), protobuf- . protobuf- gRPC- git-.
protos/
|-<service-x>/
|- **/*.proto
|-<service-y>/
|- **/*.proto
|-commons/
|- **/*.proto
proto- prototool , git- release-.
gRPC- protobufs. , protobufs- release-, protoc .
REST API RAML, Swagger . . gRPC protoc-gen-doc.
gRPC
gRPC , REST-, gRPC. , , REST API.
REST- gRPC , gRPC. .
gRPC. gRPC- — grpc-web. gRPC- . grpc-web, GA- , . JSON- , proto . SDK.
Protobuf
API :
null
null
proto3, . , , google wrappers. null , , update null. .
gRPC HTTP-
, REST-, , HTTP- , , / , ..
gRPC-, HTTP-, . gRPC "Interceptors" () . , gRPC-, , .
Protobuf
Protocol buffers : Proto2 Proto3. gRPC . Proto2 Proto3 , .
1. proto2 proto3
|
Proto2 |
Proto3 |
NULL |
|
|
|
|
|
|
|
. . |
JSON |
. protobuf |
JSON |
UTF-8 |
|
|
, |
|
. Proto3, , , . , (wrappers, ) . |
, protocol buffers . 1, proto2 proto3. , gRPC- proto2, . , , , , proto2. proto3, , proto2.
, , gRPC , gRPC.
:
/ , .
HTTP/2 .
.
.
, , , , .
OTUS 2 Java- c . :
- Java Developer. Professional
- , 19 . :
- gRPC REST- .