grpc: the story of microservices at square
TRANSCRIPT
©2016 Apigee Corp. All Rights Reserved.
©2016 Apigee Corp. All Rights Reserved.
Slideshare slideshare.com/apigee
Apigee Community https://community.apigee.com
YouTube"youtube.com/apigee
gRPC: Microservices at Square Manik Surtani Senior Infrastructure Engineer, Square @maniksurtani
We <3 JSON/HTTP
We also <3 monoliths* (*) Not really. http://squ.re/spot
We preferred microservices
Java
Go
Ruby
Java
Go
Ruby
x 500
Stubby and Sake
● JSON/HTTP for mobile & web client comms ● Replace server comms with Sake ● Stubby DNA ● Implements protobuf services ○ proto2
Sake Often better warm
● Java ○ Asynchronous comms, blocking APIs ○ Deadline propagation ○ ACLs ○ Integrates with service discovery ○ Distributed tracing ○ Retry logic ● Ported to Go ● Ruby support via a sidecar ○ Based on the Java impl
Modernizing Sake
● Move networking to Netty ● Open source Sake! ● Move to HTTP/2 ○ Streaming! ● Native Ruby implementations ○ No more sidecars
ARCWire
● A Google effort ● A proto service based RPC
framework ● Stubby DNA ● HTTP/2 ● Open Source
gRPC Features
● Request/response as well as bidirectional streams ● Synchronous and asynchronous ● Backed by non-blocking IO ● Header compression ● Multiplexing requests over a single connection ● Built with mobile clients in mind ○ Better battery life, data usage than JSON/HTTP
Supported Platforms
Java (inc. Android) Python Go PHP C Ruby C++ Node.js Objective-C C#
Message format
● Built for protocol buffers * ● Pluggable ● Other serialization formats could be used instead ○ Avro, Thrift, Cap’n Proto, etc.
* http://developers.google.com/protocol-buffers
Protocol buffers
● Language-neutral, platform-neutral ● Extensible ● Binary, very compact ● Strongly typed ● Versioned ● Easily transformed to JSON for debugging
Protocol Buffers
Protocol Buffer Services
Protocol Buffers
gRPC Server
gRPC Server
gRPC Client
Adding gRPC to your stack
● Protobuf version control ● Service discovery ● Load balancing ● Security ● Logging ● Metrics
gRPC performance
● Measured by etcd * ● 120µs round trips, compared to 1.6ms roundtrips for JSON/HTTP ● 3 orders of magnitude?!
* http://bit.ly/etcd_grpc
©2016 Apigee Corp. All Rights Reserved.
Slideshare slideshare.com/apigee
Apigee Community https://community.apigee.com
YouTube"youtube.com/apigee
Thank you