RPC
In distributed computing a remote procedure call (RPC) is when a computer program causes a procedure to execute in another address space which is coded as if it were a local procedure call.
gRPC
a modern, open source remote procedure call (RPC) framework that can run anywhere.
features
BSD licensed ⇒ OSS
HTTP/2 based ⇒ streams, mux...
easy ⇒ IDL based, codegen
highly performant & scalable
implementations ⇒ C++, Java, Objective-C, Python, Ruby, Go, C#, Node.js, PHP.
commitment ⇒ Google's public services as gRPC
HTTP/2 capabilities
bidirectional streaming ⇒ req/resp, s2c, c2s
flow control ⇒ quotas
header compression ⇒ bandwidth save
single TCP connection ⇒ multiplexing, lower lantency
Examples:
bidirectional stream: chat session
server → client stream: stock ticker
client → server stream: sensor aggregation
protocol buffers v3
language-neutral, platform-neutral, extensible mechanism for serializing structured data
IDL: interface definition language
gRPC service definition
codegen
binary serialization
example
syntax = "proto3";
package clock;
service Clock {
rpc WhatTimeIsIt(ClockRequest) returns (stream ClockResponse);
}
message ClockRequest {
string name = 1;
}
message ClockResponse {
string message = 1;
}
demo
protobufs +
go server +
PHP node go client