Save 37% off PRO during our Black Friday Sale! »

Oracle Cloud Hangout Cafe - サービス間通信のトレンド - gRPC & GraphQL入門 / ochacafe-grpc-graphql

Oracle Cloud Hangout Cafe - サービス間通信のトレンド - gRPC & GraphQL入門 / ochacafe-grpc-graphql

Oracle Cloud Hangout Cafe(おちゃかふぇ)のセッションスライドです。

(セッションの録画)
https://youtu.be/khwBXnUxDak

(イベントページ)
https://ochacafe.connpass.com/event/183721/

140494d272a4d89883a94fdfdb29dea2?s=128

oracle4engineer
PRO

August 27, 2020
Tweet

Transcript

  1. gRPC GraphQL Kyotaro Nonaka Solution Engineer Oracle Corporation Japan August

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

    © 2020, Oracle and/or its affiliates 2
  3. Copyright © 2020, Oracle and/or its affiliates 3

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

  5. 5 Copyright © 2020, Oracle and/or its affiliates 1. 2.

    RESTful 3. gRPC 4. GraphQL
  6. • • • EC • OCHaCafe 3 3 • 10

    • 20 FC 15 • Copyright © 2020, Oracle and/or its affiliates 6 @non_kyon
  7. Copyright © 2020, Oracle and/or its affiliates 7 REST API

  8. RESTful API REST 4 API • • • • Web

    • • GET, POST HTTP • URL/URI API Copyright © 2020, Oracle and/or its affiliates 8 HTTP
  9. • URL/URI API • REST • HTTP • Copyright ©

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

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

  12. 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 /
  13. Stubby Google DC RPC • HTTP2 2015 OSS • Microservices

    Copyright © 2020, Oracle and/or its affiliates 13 PanCakes GoldenRetriever PanCakes gRPC
  14. 2017 CNCF 6 • 2020 8 Incubating Microservices Cloud Native

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

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

    • • • • Protocol Buffers gRPC JSON Copyright © 2020, Oracle and/or its affiliates 16 .proto (IDL)
  17. 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
  18. 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
  19. gRPC Server Client Server • Client • • Server Stub

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

    Copyright © 2020, Oracle and/or its affiliates 20
  21. gRPC .proto Copyright © 2020, Oracle and/or its affiliates 21

    Protocol Buffers v3(2016 ) .proto import
  22. .proto • RPC • stream / Copyright © 2020, Oracle

    and/or its affiliates 22 • RPC • RPC • RPC • RPC
  23. message( ) Copyright © 2020, Oracle and/or its affiliates 23

    int, string message
  24. gRPC Client Server ( ) .proto • • Copyright ©

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

    2020, Oracle and/or its affiliates 25 HelloWorldServer.java
  26. Helidon gRPC Copyright © 2020, Oracle and/or its affiliates 26

    Interface Client Service(Server) @Grpc, @Unary, @ServerStreaming gRPC
  27. 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
  28. Copyright © 2020, Oracle and/or its affiliates 28 gRPC

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

    29 .proto
  30. • 1 1 • 1 .proto Server Copyright © 2020,

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

    and/or its affiliates 31 {name: gRPC} {hello gRPC} 10 Java gRPC Client Java gRPC Server
  32. • 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}
  33. • 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
  34. Copyright © 2020, Oracle and/or its affiliates 34 + Java

    gRPC on Helidon Interface Client Service(Server)
  35. • (HTTP/2 + protobuf) • • Microservices / • •

    .proto • Copyright © 2020, Oracle and/or its affiliates 35
  36. Copyright © 2020, Oracle and/or its affiliates 36 GraphQL

  37. Facebook • 2012 Web • REST API / Facebook GraphQL

    2015 GraphQL graphql.js OSS 2018 GraphQL Foundation Copyright © 2020, Oracle and/or its affiliates 37
  38. GraphQL (nodes/vertices) (edges) • edges • • Copyright © 2020,

    Oracle and/or its affiliates 38 CEO CTO COO VP VP Mgr Mgr Mgr ( ) O H H
  39. 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
  40. 3 / Copyright © 2020, Oracle and/or its affiliates 40

    query: subscription: WebSocket mutation: POST/UPDATE/DELETE
  41. • 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
  42. GraphQL Copyright © 2020, Oracle and/or its affiliates 42 built-in

    Scalar type(Int, Float, String, Boolean, ID) Scalar type Enum Query Mutation • input( )
  43. 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/…
  44. 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
  45. GraphQL Server Resolver • Resolver Client • Resolver Function •

    GraphQL Server JavaScript • • • • • • FaaS • Copyright © 2020, Oracle and/or its affiliates 45 mutation
  46. • API GraphQL Java 2020 • GraphQL Java API •

    2 • • Copyright © 2020, Oracle and/or its affiliates 46
  47. Copyright © 2020, Oracle and/or its affiliates 47 query Customer

    GraphQL Server • Customer • GraphQL Server query Database
  48. 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
  49. API • GraphQL GraphQL Server REST • HTTP ( 200

    ) • (URI) GraphQL Server • Resolver • • JSON • base64 Copyright © 2020, Oracle and/or its affiliates 49
  50. Copyright © 2020, Oracle and/or its affiliates 50 id DB

    API ID
  51. Copyright © 2020, Oracle and/or its affiliates 51 / non-nullable

    ! ( )
  52. Copyright © 2020, Oracle and/or its affiliates 52 allCustomers subscription

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

  54. • 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
  55. • GraphQL • GraphQL Server JavaScript • GraphQL Vue Apollo

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

    API 1 Copyright © 2020, Oracle and/or its affiliates 56
  57. 57 Copyright © 2020, Oracle and/or its affiliates

  58. None
  59. Our mission is to help people see data in new

    ways, discover insights, unlock endless possibilities.