4. Moving to Microservices
eCom Store Web
Catalog
Management
Customer Accounts
Order Management
Payment
Shipment
Store DB
Catalog DB
Customer DB
Order DB
Payment DB
Shipment DB
5. Communications on
Microservices
• Inter-process communication between
Microservices
• Serialisation and Deserialisation of Messages
• Scaling APIs into billions of APIs calls
• Building streaming APIs
• RESTful with JSON or RPC with Binary
Encoding?
6. Why Not REST
• Uses HTTP/1.x; Separate TCP Connection per
request
• Text on the wire; Not performance efficient
• Harder API Evolution
• Not Domain-Specific, Not Strongly-Typed
• Lack of Streaming capabilities
7.
8. • High performance, open-source RPC framework
• Open source version of Google’s internal framework Stubby
• Uses Protocol Buffers as the IDL
• HTTP/2 for transport
• Bi-Directional streaming
• RPC is Efficient, Domain-Specific and Strongly-Typed
• Works across languages and platforms
9. • Google's language-neutral, platform-neutral,
extensible mechanism for serialising structured
data
• IDL - Describe once and generate interfaces for
multiple languages
• Structure of the Request and Response
• Binary format for network transmission
• Supports multiple languages
Protocol Buffers
17. Installation
# Install Protocol Buffers compiler
$ brew install protobuf (macOS)
(Or download from https://github.com/google/protobuf/releases/tag/v3.0.0)
# Install Go Plugin
$ go get github.com/golang/protobuf/protoc
$ go get github.com/golang/protobuf/protoc-gen-go
# Install Go RPC Framework
$ go get google.golang.org/grpc