gRPC

 

By: Hamdi Ahmadi Muzakkiy

gRPC [Jee-Arr-Pee-See.]

google Remote Procedure Call

What?

gRPC is an open source remote procedure call (RPC) system initially developed at Google. It uses HTTP/2 for transport, Protocol Buffers as the interface description language, and provides features such as authentication, bidirectional streaming and flow control, blocking or nonblocking bindings, and cancellation and timeouts. It generates cross-platform client and server bindings for many languages.

Why?

  • Low latency, highly scalable, distributed systems.
  • Developing mobile clients which are communicating to a cloud server.
  • Designing a new protocol that needs to be accurate, efficient and language independent.
  • Layered design to enable extension eg. authentication, load balancing, logging and monitoring etc.

Supported Programming Language

  • C++
  • Java
  • Objective-C
  • Python
  • Ruby
  • Go
  • C#
  • Node.js

How To?

  • Install Protobuf
  • Create *.proto file
  • go get -u github.com/golang/protobuf/protoc-gen-go
  • run "protoc --go_out=plugins=grpc:{{dest/dir}} *.proto"
  • *.pb.go created

*.proto file

  • Define Request & Response data 
  • Define method

Example

gRPC VS Rest

  • Running 1000 request
  • End Point Used To Add 2 Number From Request

 

Made with Slides.com