Upgrade to Pro — share decks privately, control downloads, hide ads and more …

gRPC vs REST - API Strat 2016

gRPC vs REST - API Strat 2016

Comparing gRPC and REST for building an Microservices API.

Tweet at @sandeepdinesh for more info!

Sandeep Dinesh

November 03, 2016
Tweet

More Decks by Sandeep Dinesh

Other Decks in Technology

Transcript

  1. @sandeepdinesh JSON vs Protobuf plaintext vs binary human readable vs

    machine readable repetitive vs compressed fast (de)serialization vs faster (de)serialization* Everything supports it vs limited support
  2. @sandeepdinesh HTTP 1.1 vs. HTTP/2 plaintext vs binary no pipelining

    vs native pipelining new connection per request vs persistent TCP connection repetitive vs compressed polling vs streaming Non-secure by default vs TLS by default Everything supports it vs limited support
  3. @sandeepdinesh 1) Force clients to upgrade or use the old

    service 2) Create gRPC and REST endpoints for the new service
  4. @sandeepdinesh 1) Force clients to upgrade or use the old

    service 2) Create gRPC and REST endpoints for the new service https://commons.wikimedia.org/wiki/File:Carrot-fb.jpg https://pixabay.com/en/photos/wooden%20stick/ >
  5. @sandeepdinesh message Person { enum PhoneType { MOBILE = 0;

    HOME = 1; WORK = 2; } message PhoneNumber { string number = 1; PhoneType type = 2; } string name = 1; int32 id = 2; string email = 3; repeated PhoneNumber phone = 4; } { "name": "‘Sandeep’", "id": 123, "email": "‘[email protected]’", "phone": [ { "number": 1234566543, "type": "‘HOME’" }, { "number": 1234566545, "type": "‘MOBILE’" } ] }
  6. @sandeepdinesh syntax = "proto3"; package pingpong; import "google/api/annotations.proto"; service PingPong

    { rpc SyncPerson (Person) returns (Base64) { option (google.api.http) = { post: "/addperson" body: "*" }; } }