Slide 1

Slide 1 text

gRPC GraphQL Kyotaro Nonaka Solution Engineer Oracle Corporation Japan August 27th, 2020

Slide 2

Slide 2 text

以下の事項は、弊社の一般的な製品の方向性に関する概要を説明するものです。また、 情報提供を唯一の目的とするものであり、いかなる契約にも組み込むことはできません。以 下の事項は、マテリアルやコード、機能を提供することを確約するものではないため、購買 決定を行う際の判断材料になさらないで下さい。 オラクル製品に関して記載されている機能の開発、リリース、時期及び価格については、弊 社の裁量により決定され、変更される可能性があります。 Safe harbor statement Copyright © 2020, Oracle and/or its affiliates 2

Slide 3

Slide 3 text

Copyright © 2020, Oracle and/or its affiliates 3

Slide 4

Slide 4 text

gRPC GraphQL Copyright © 2020, Oracle and/or its affiliates 4

Slide 5

Slide 5 text

5 Copyright © 2020, Oracle and/or its affiliates 1. 2. RESTful 3. gRPC 4. GraphQL

Slide 6

Slide 6 text

• • • EC • OCHaCafe 3 3 • 10 • 20 FC 15 • Copyright © 2020, Oracle and/or its affiliates 6 @non_kyon

Slide 7

Slide 7 text

Copyright © 2020, Oracle and/or its affiliates 7 REST API

Slide 8

Slide 8 text

RESTful API REST 4 API • • • • Web • • GET, POST HTTP • URL/URI API Copyright © 2020, Oracle and/or its affiliates 8 HTTP

Slide 9

Slide 9 text

• URL/URI API • REST • HTTP • Copyright © 2020, Oracle and/or its affiliates 9 /api/easytouse GET POST PUT DELETE

Slide 10

Slide 10 text

REST API • • • / Copyright © 2020, Oracle and/or its affiliates 10

Slide 11

Slide 11 text

Copyright © 2020, Oracle and/or its affiliates 11 gRPC

Slide 12

Slide 12 text

RPC Remote Procedure Call • REST • REST RPC • RPC RPC • JSON-RPC: JSON • XML-RPC: XML • Adobe Flex: AMF( ) Copyright © 2020, Oracle and/or its affiliates 12 /

Slide 13

Slide 13 text

Stubby Google DC RPC • HTTP2 2015 OSS • Microservices Copyright © 2020, Oracle and/or its affiliates 13 PanCakes GoldenRetriever PanCakes gRPC

Slide 14

Slide 14 text

2017 CNCF 6 • 2020 8 Incubating Microservices Cloud Native / • Netflix • Dropbox • etcd Copyright © 2020, Oracle and/or its affiliates 14

Slide 15

Slide 15 text

Protocol Buffers • Google (2008 ) • / HTTP/2 • • • • • Copyright © 2020, Oracle and/or its affiliates 15

Slide 16

Slide 16 text

Protocol Buffers • Google (2008 ) • IDL( ) / • • • • Protocol Buffers gRPC JSON Copyright © 2020, Oracle and/or its affiliates 16 .proto (IDL)

Slide 17

Slide 17 text

HTTP/2 Connection HTTP/2 HTTP/1.1 • gRPC HTTP/2 • • • • • Copyright © 2020, Oracle and/or its affiliates 17 gRPC Client gRPC Server • / • request response

Slide 18

Slide 18 text

Unary RPC • RPC 1 1 RPC • 1 RPC • 1 RPC • / Copyright © 2020, Oracle and/or its affiliates 18 gRPC Client gRPC Server request response gRPC Client gRPC Server request response gRPC Client gRPC Server request response gRPC Client gRPC Server request response

Slide 19

Slide 19 text

gRPC Server Client Server • Client • • Server Stub Stub Copyright © 2020, Oracle and/or its affiliates 19

Slide 20

Slide 20 text

HTTP/1 • HTTP/2 • curl REST IDL( ) • • Copyright © 2020, Oracle and/or its affiliates 20

Slide 21

Slide 21 text

gRPC .proto Copyright © 2020, Oracle and/or its affiliates 21 Protocol Buffers v3(2016 ) .proto import

Slide 22

Slide 22 text

.proto • RPC • stream / Copyright © 2020, Oracle and/or its affiliates 22 • RPC • RPC • RPC • RPC

Slide 23

Slide 23 text

message( ) Copyright © 2020, Oracle and/or its affiliates 23 int, string message

Slide 24

Slide 24 text

gRPC Client Server ( ) .proto • • Copyright © 2020, Oracle and/or its affiliates 24 example.proto Client Server Maven/ Gradle Client Server

Slide 25

Slide 25 text

Client • Server Stub Stub(class) RPC Server • Copyright © 2020, Oracle and/or its affiliates 25 HelloWorldServer.java

Slide 26

Slide 26 text

Helidon gRPC Copyright © 2020, Oracle and/or its affiliates 26 Interface Client Service(Server) @Grpc, @Unary, @ServerStreaming gRPC

Slide 27

Slide 27 text

Protocol Buffers + • Java • Protocol Buffers gRPC GrpcMpExtension • io.helidon.microprofile.grpc.server.s pi.GrpcMpExtension gRPC Copyright © 2020, Oracle and/or its affiliates 27 proto request response + Protocol Buffers Extension

Slide 28

Slide 28 text

Copyright © 2020, Oracle and/or its affiliates 28 gRPC

Slide 29

Slide 29 text

• .proto • Copyright © 2020, Oracle and/or its affiliates 29 .proto

Slide 30

Slide 30 text

• 1 1 • 1 .proto Server Copyright © 2020, Oracle and/or its affiliates 30 Java gRPC Client Java gRPC Server Node gRPC Server

Slide 31

Slide 31 text

• 1 • Client/Server Unary RPC Copyright © 2020, Oracle and/or its affiliates 31 {name: gRPC} {hello gRPC} 10 Java gRPC Client Java gRPC Server

Slide 32

Slide 32 text

• 1 • Unary Client Stub Copyright © 2020, Oracle and/or its affiliates 32 Java gRPC Client Java gRPC Server {name: a} {name: b} {name: c} {hello a, hello b , hello c}

Slide 33

Slide 33 text

• Server Streaming ClientStreaming Streaming • • Client sleep Copyright © 2020, Oracle and/or its affiliates 33 {name: a} {name: b} {name: c} {hello a} {hello b} {hello c} Java gRPC Server Java gRPC Client

Slide 34

Slide 34 text

Copyright © 2020, Oracle and/or its affiliates 34 + Java gRPC on Helidon Interface Client Service(Server)

Slide 35

Slide 35 text

• (HTTP/2 + protobuf) • • Microservices / • • .proto • Copyright © 2020, Oracle and/or its affiliates 35

Slide 36

Slide 36 text

Copyright © 2020, Oracle and/or its affiliates 36 GraphQL

Slide 37

Slide 37 text

Facebook • 2012 Web • REST API / Facebook GraphQL 2015 GraphQL graphql.js OSS 2018 GraphQL Foundation Copyright © 2020, Oracle and/or its affiliates 37

Slide 38

Slide 38 text

GraphQL (nodes/vertices) (edges) • edges • • Copyright © 2020, Oracle and/or its affiliates 38 CEO CTO COO VP VP Mgr Mgr Mgr ( ) O H H

Slide 39

Slide 39 text

GraphQL HTTP API Facebook Github, Airbnb, Twitter • : https://graphql.org/users/ GraphQL Foundation CNCF GraphQL landscape • : https://landscape.graphql.org/ Copyright © 2020, Oracle and/or its affiliates 39 GraphQL GraphQL

Slide 40

Slide 40 text

3 / Copyright © 2020, Oracle and/or its affiliates 40 query: subscription: WebSocket mutation: POST/UPDATE/DELETE

Slide 41

Slide 41 text

• URI REST • GraphQL Server Copyright © 2020, Oracle and/or its affiliates 41 GraphQL Client GraphQL Server Database Backend 3rd party API GraphQL GraphQL Server REST Client Backend 3rd party API REST API Database

Slide 42

Slide 42 text

GraphQL Copyright © 2020, Oracle and/or its affiliates 42 built-in Scalar type(Int, Float, String, Boolean, ID) Scalar type Enum Query Mutation • input( )

Slide 43

Slide 43 text

GraphQL Client Server GraphQL Server DB Copyright © 2020, Oracle and/or its affiliates 43 GraphQL Client GraphQL Server Database Backend 3rd party API query { ⁝ } GET /api/…

Slide 44

Slide 44 text

GraphQL GET POST GraphQL 2 • Apollo Client: GraphQL Apollo 1 JavaScript (React, Vue, Angular) • Relay: Facebook React/React Native Client Copyright © 2020, Oracle and/or its affiliates 44 curl -X POST -H "Content-Type: application/json" -d '{"query": "{ hello }"}' http://localhost:4000/graphql CURL

Slide 45

Slide 45 text

GraphQL Server Resolver • Resolver Client • Resolver Function • GraphQL Server JavaScript • • • • • • FaaS • Copyright © 2020, Oracle and/or its affiliates 45 mutation

Slide 46

Slide 46 text

• API GraphQL Java 2020 • GraphQL Java API • 2 • • Copyright © 2020, Oracle and/or its affiliates 46

Slide 47

Slide 47 text

Copyright © 2020, Oracle and/or its affiliates 47 query Customer GraphQL Server • Customer • GraphQL Server query Database

Slide 48

Slide 48 text

GraphiQL/GraphQL Playground • GraphQL IDE • GraphiQL GraphQL Foundation • Playground Prisma Apollo • GraphQL Client, Server, CLI • Client React, Vue, Angular FW • Server Heroku, AWS Lambda, Azure Functions Hasura GraphQL Engine • Postgres GraphQL Server • GraphQL Foundation CNCF Copyright © 2020, Oracle and/or its affiliates 48

Slide 49

Slide 49 text

API • GraphQL GraphQL Server REST • HTTP ( 200 ) • (URI) GraphQL Server • Resolver • • JSON • base64 Copyright © 2020, Oracle and/or its affiliates 49

Slide 50

Slide 50 text

Copyright © 2020, Oracle and/or its affiliates 50 id DB API ID

Slide 51

Slide 51 text

Copyright © 2020, Oracle and/or its affiliates 51 / non-nullable ! ( )

Slide 52

Slide 52 text

Copyright © 2020, Oracle and/or its affiliates 52 allCustomers subscription

Slide 53

Slide 53 text

Copyright © 2020, Oracle and/or its affiliates 53 GraphQL

Slide 54

Slide 54 text

• Node.js(Express) + Apollo GraphQL Server • query/mutation/subscription GraphQL Playground(GraphQL IDE) Copyright © 2020, Oracle and/or its affiliates 54 Node.js Express GraphQL Server Playground endpoint Playground UI

Slide 55

Slide 55 text

• GraphQL • GraphQL Server JavaScript • GraphQL Vue Apollo Copyright © 2020, Oracle and/or its affiliates 55

Slide 56

Slide 56 text

• • • • • • (Web/Native ) • GraphQL API 1 Copyright © 2020, Oracle and/or its affiliates 56

Slide 57

Slide 57 text

57 Copyright © 2020, Oracle and/or its affiliates

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Our mission is to help people see data in new ways, discover insights, unlock endless possibilities.