Intro To gRPC

  • gRPC = gRPC Remote Procedure Call

  • Client can directly call a procedure on server as if it's local one.

  • Uses protocol buffers as:

    • Interface Definition Language (IDL)
    • Message interchange format

Why

  • Define service once => generate servers, clients

  • The complexity of communication between different languages and environments is handled by gRPC

  • + All Protocol Buffers Advantages

  • + All HTTP 2.0 Advantages

  • Supported Languages

  • Deadlines/Timeouts

  • Bi-Directional Streaming

gRPC vs REST

gRPC REST
Serialization Format Protocol Buffers JSON
Transfer Protocol
 
HTTP 2.0 HTTP 1.1
Streaming Supported Not Supported
Type Strongly Weakly

How?

service ServiceName {
  rpc procedureName (commaSeparatedParameters) returns (returnType) {}
}

Server

Client

Implements the methods declared by the service and runs a gRPC server to handle client calls.

Has a local object known as "stub" that implements the same methods as the service.

The client can then just call those methods on the local object.

proto compile

Agenda

  • What is gRPC
  • Why gRPC
  • gRPC vs REST
  • How to define a service
  • Hands on
Made with Slides.com