Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Oracle Cloud Hangout Cafe - サービス間通信のトレンド - gRPC...

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

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

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

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

oracle4engineer

August 27, 2020
Tweet

More Decks by oracle4engineer

Other Decks in Technology

Transcript

  1. • • • EC • OCHaCafe 3 3 • 10

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

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

    2020, Oracle and/or its affiliates 9 /api/easytouse GET POST PUT DELETE
  4. 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 /
  5. Stubby Google DC RPC • HTTP2 2015 OSS • Microservices

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

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

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

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

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

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

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

    and/or its affiliates 22 • RPC • RPC • RPC • RPC
  15. gRPC Client Server ( ) .proto • • Copyright ©

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

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

    Interface Client Service(Server) @Grpc, @Unary, @ServerStreaming gRPC
  18. 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
  19. • 1 1 • 1 .proto Server Copyright © 2020,

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

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

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

    .proto • Copyright © 2020, Oracle and/or its affiliates 35
  25. Facebook • 2012 Web • REST API / Facebook GraphQL

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

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

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

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

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

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

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

    ) • (URI) GraphQL Server • Resolver • • JSON • base64 Copyright © 2020, Oracle and/or its affiliates 49
  38. • 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
  39. • GraphQL • GraphQL Server JavaScript • GraphQL Vue Apollo

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

    API 1 Copyright © 2020, Oracle and/or its affiliates 56
  41. Our mission is to help people see data in new

    ways, discover insights, unlock endless possibilities.