Google confidential │ Do not distribute Google confidential │ Do not distribute gRPC: A multi-platform RPC system Louis Ryan 26th February 2016
Google confidential │ Do not distribute Microservices at Google ~O(1010 ) RPCs per second. Images by Connie Zhou
Open source on Github for C, C++, Java, Node.js, Python, Ruby, Go, C#, PHP, Objective-C gRPC core gRPC java
gRPC is ... Open Source RPC framework that makes it easy to build a heterogenous distributed system. ●くろまる Free as in beer! (and licensing) ●くろまる Based on HTTP/2 today (multiplexed, works with the Internet) ●くろまる Payload agnostic (we’ve implemented proto) ●くろまる Streaming & Flow-Controlled ●くろまる Designed for harsh environments (timeout, lameducking, load-balancing, cancellation, ...) ●くろまる Support in 10 languages & first class mobile support ●くろまる Layered & Pluggable - Bring your own monitoring, auth, naming, load balancing ...
●くろまる Core features and protocol are fully specified ●くろまる Rolled out for public Google APIs and widely used internally ○しろまる Lots of mobile adoption ●くろまる Approaching 1.0 (GA) release in all languages ○しろまる Stable APIs for key features ●くろまる Benefit of layering on top of HTTP/2 standard ○しろまる Interoperability with 3rd party proxies, tools, libraries.. ○しろまる WHATWG Fetch Project Status
HTTP/2HTTP/1.1 http://www.http2demo.io/
message SubscribeRequest { string topic = 1; } message Event { string details = 1; } service Topics { rpc Subscribe(SubscribeRequest) returns (stream Event); } IDL (Interface definition language) Describe once and generate interfaces for any language. Data Model Structure of the request and response. Binary format for network transmission. Wire Format Protocol Buffers
●くろまる Three complete stacks: C/C++, Java and Go. ●くろまる Other language implementations wrap C-Runtime libraries. ○しろまる Hand-written wrappers to maintain language idioms ●くろまる Why wrap C? ○しろまる Development costs & Implementation Consistency ○しろまる Performance ○しろまる Feature evolution ●くろまる Easy one line installation via packages e.g npm install grpc Implementation Details
Google confidential │ Do not distribute Use Cases Client-server communication Access Google Cloud Services Build distributed applications Images by Connie Zhou • In data-centers • In public/private cloud • Clients and servers across: • Mobile • Web • Cloud • Also • Embedded systems, IoT • From GCP • From Android and iOS devices • From everywhere else
●くろまる Install ○しろまる apt-get install protobuf-compiler ○しろまる pip install grpcio ●くろまる Write the protos ●くろまる Use protoc to generate service interfaces, messages & stubs ●くろまる Implement services in server ●くろまる Client instantiates stub ●くろまる Test & Deploy Typical development workflow
●くろまる Auth & Security - TLS [Mutual], Plugin auth mechanism (e.g. OAuth) ●くろまる Proxies - nghttp2, haproxy, Google LB, Nginx (in progress) ●くろまる Client-side load balancing - etcd, Zookeeper, Eureka, ... ●くろまる Monitor & Trace - Zipkin, Google, DIY ●くろまる Mobile - Reconnect, QUIC ●くろまる Web - REST Adapter, WHATWG Fetch ●くろまる API Evolution - Protobuf, Versioning Advanced Deployment...
gRPC Core Http 2.0 SSL Code Generated API Planned in: C/C++, Java, GoApplication Layer Framework Layer Transport Layer Architecture: Native Implementation in Language
Generic Low Level API in C Python Code-Generated Language Idiomatic API Obj-C, C#, C++, ... Ruby PHPPython gRPC Core in C Http 2.0 SSL Language Bindings Code Generated Ruby PHP Obj-C, C#, C++,... Application Layer Framework Layer Transport Layer Architecture: Derived Stack
Wire Implementation across languages gRPC Core Http 2.0 SSL Code Generated API Auth Architecture and API Credentials API Auth-Credentials Implementation AuthPluginAPI
●くろまる Generic mechanism for attaching metadata to requests and responses ●くろまる Built into the gRPC protocol - always available ●くろまる Plugin API to attach "bearer tokens" to requests for Auth ○しろまる OAuth2 access tokens ○しろまる OIDC Id Tokens ●くろまる Session state for specific Auth mechanisms is encapsulated in an Auth- credentials object Metadata and Auth
gRPC: Naming client nameserver servers name addresses, ...
gRPC: LoadBalancing client LB Controller servers Control RPC address-list
Initial Alpha Release Beta Release Stability, Easy installation, 1.0 release Q1 ‘16 Roadmap: Timeline Q2 ‘15 Q3 ‘15, Q4’15 Q1 ‘15 Q2 ‘16 Q3 16 Additional Alpha Releases Load balancing, Naming, Performance Debugging and Tracing, Browser support
Thank you! Thank you! Twitter: @grpcio Site: grpc.io Group: grpc-io@googlegroups.com