Slide 1

Slide 1 text

Integrating east / west services in high performance! Luram Archanjo

Slide 2

Slide 2 text

Who am I? ● Software Engineer at Sensedia ● MBA in Java projects ● Java and Microservice enthusiastic

Slide 3

Slide 3 text

Agenda ● Microservices ● Communication Pattern ● gRPC ● Questions

Slide 4

Slide 4 text

Moving to Microservices Feature A Feature B Feature C Monolith Microservice Microservice Microservices Microservice

Slide 5

Slide 5 text

● Communication ● Security / Authentication ● Network Communication Speed ● Language Interoperability Challenges with Microservices

Slide 6

Slide 6 text

Communication Microservice Microservice Microservice Microservice Microservice Microservice Microservice Microservice

Slide 7

Slide 7 text

Communication Microservice Microservice Microservice HTTP + JSON REpresentational State Transfer Microservice Microservice BD

Slide 8

Slide 8 text

Microservice Communication Microservice Microservice Microservice Microservice Microservice Microservice Microservice Microservice

Slide 9

Slide 9 text

Communication Patterns

Slide 10

Slide 10 text

Communication Patterns Microservice Microservice API GATEWAY Microservice Microservice API GATEWAY North / South East / West

Slide 11

Slide 11 text

Communication Patterns Microservice Microservice API GATEWAY East / West Synchronous Microservice Microservice API GATEWAY East / West Asynchronous REST

Slide 12

Slide 12 text

Communication Patterns Microservice Microservice API GATEWAY East / West Synchronous REST ● Web already built on top of HTTP ● Easy to understand ● Variety of http implementation in any languages ● Loose coupling between client and server

Slide 13

Slide 13 text

Communication Patterns Microservice Microservice API GATEWAY East / West Synchronous REST ● Operations are difficult to model ● Streaming is difficult to implement ● Bi-directional streaming is not possible ● Inefficient, textual representation are not optimal for networks

Slide 14

Slide 14 text

Ok….REST is OK for IPC, but I want to improve!

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

What is RPC and gRPC?

Slide 17

Slide 17 text

● A high-performance open-source universal RPC framework ● Based on “Stubby” (Google’s internal RPC system) ● Part of Cloud Native Computing Foundation

Slide 18

Slide 18 text

So what makes gRPC so effective?

Slide 19

Slide 19 text

● Strongly typed ● Rules for making backwards compatible changes ● Efficient binary data representation for network transmission ● Comprehensive style guide Protocol Buffers Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.

Slide 20

Slide 20 text

Interface Definition Language The API definition and structure of the payload messages. syntax = “proto3”; message PersonRequest { string name = 1; int32 age = 2; } message PersonResponse { int32 id = 1; string name = 2; int32 age = 3; } service PersonService { rpc create(PersonRequest) returns (PersonResponse); }

Slide 21

Slide 21 text

Define once, generates well-structured code for all supported language!

Slide 22

Slide 22 text

Ruby microservice gRPC server Go microservice gRPC server gRPC Stub Java microservice gRPC Stub Python microservice gRPC server gRPC Stub Multiple Language Support

Slide 23

Slide 23 text

Multiple Platform Support

Slide 24

Slide 24 text

Works over HTTP 2

Slide 25

Slide 25 text

History of HTTP HTTP 0.9 1991 HTTP 1 1996 HTTP 2 2015 HTTP 1.1 16 years without evolution 1999

Slide 26

Slide 26 text

HTTP 2 ● Multiplexing ● Bidirectional Streaming ● HTTPS ● Performance HTTP 2 HTTP 1.x

Slide 27

Slide 27 text

HTTP 2 ● Multiplexing ● Bidirectional Streaming ● HTTPS ● Performance

Slide 28

Slide 28 text

HTTP 2 ● Multiplexing ● Bidirectional Streaming ● HTTPS ○ SSL/TLS ○ Token authentication ○ Channel credentials ○ Call credentials ● Performance

Slide 29

Slide 29 text

HTTP 2 ● Multiplexing ● Bidirectional Streaming ● HTTPS ● Performance HTTP 1.1 HTTP 2

Slide 30

Slide 30 text

Connection options The client sends a single request and gets back a single response Unary RPC The server sends back a stream of responses after getting the client’s request message Server streaming RPC The client sends a stream of requests to the server instead of a single request Client streaming RPC The call is initiated by the client calling the method and the server receiving the client metadata, method name, and deadline Bidirectional streaming RPC

Slide 31

Slide 31 text

Connection options Unary RPC rpc SayHello(HelloRequest) returns (HelloResponse); Server streaming RPC rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse); Client streaming RPC rpc LotsOfGreetings(stream HelloRequest) returns (HelloResponse); Bidirectional streaming RPC rpc BidiHello(stream HelloRequest) returns (stream HelloResponse);

Slide 32

Slide 32 text

Who is using gRPC?

Slide 33

Slide 33 text

Companies

Slide 34

Slide 34 text

Community

Slide 35

Slide 35 text

Why mainly Google and Netflix are using gRPC?

Slide 36

Slide 36 text

Performance Sources: https://cloud.google.com/blog/products/gcp/announcing-grpc-alpha-for-google-cloud-pubsub

Slide 37

Slide 37 text

Performance Sources: https://blog.gopheracademy.com/advent-2015/etcd-distributed-key-value-store-with-grpc-http2, https://auth0.com/blog/beating-json-performance-with-protobuf

Slide 38

Slide 38 text

Flexibility & Summary Source: https://www.infoq.com/presentations/grpc

Slide 39

Slide 39 text

Where to use gRPC?

Slide 40

Slide 40 text

Use case gRPC shines as a way to connect servers in service-oriented environments Microservices gRPC works just as well in client-server applications, where the client application runs on desktop or mobile devices Client-Server Application gRPC is also a way to offer APIs over the Internet, for integrating applications with services from third-party providers Integrations and APIs Connecting mobile devices, browser clients to backend services Browser-based Web Applications

Slide 41

Slide 41 text

Thanks a million! /larchanjo /luram-archanjo