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

gRPC with Go

ktr
July 22, 2017

gRPC with Go

ktr

July 22, 2017
Tweet

More Decks by ktr

Other Decks in Programming

Transcript

  1. GRPC with Go @ktr_0731

  2. Profile $ whoami ‣ Taro Aoki / @ktr_0731 ‣ s123@u-aizu

    ‣ αʔόαΠυΤϯδχΞ ‣ Go ͕޷͖ (9 ϲ݄͘Β͍) ‣ Web ͕޷͖
  3. None
  4. None
  5. None
  6. What is gRPC?

  7. gRPC A RPC library and framework ‣ IDL(Interface Definition Language)

    Ͱ Service Λఆٛ ‣ σϑΥϧτ͸ Protocol Buffers ‣ αʔό / ΫϥΠΞϯτͷελϒΛࣗಈͰ࡞ͬͯ͘ΕΔ ‣ Interceptors ͕ศར ‣ middleware ͷΑ͏ͳ΋ͷ
  8. gRPC A RPC library and framework ‣ package ‣ messages

    ‣ services ‣ RPCs
  9. None
  10. None
  11. gRPC A RPC library and framework ‣ IDL(Interface Definition Language)

    Ͱ Service Λఆٛ ‣ σϑΥϧτ͸ Protocol Buffers ‣ αʔό / ΫϥΠΞϯτͷελϒΛࣗಈͰ࡞ͬͯ͘ΕΔ ‣ Interceptors ͕ศར ‣ middleware ͷΑ͏ͳ΋ͷ
  12. gRPC A RPC library and framework ‣ IDL(Interface Definition Language)

    Ͱ Service Λఆٛ ‣ σϑΥϧτ͸ Protocol Buffers ‣ αʔό / ΫϥΠΞϯτͷελϒΛࣗಈͰ࡞ͬͯ͘ΕΔ ‣ Interceptors ͕ศར ΋ͷָ͘͢͝!!
  13. gRPC What does "g"RPC stands for? ‣ 1.0: gRPC ‣

    1.1: good ‣ 1.2: green ‣ 1.3: gentle ‣ 1.4: gregarious
  14. gRPC gRPC with Go ‣ gRPC ͱ Go ͸૬ੑ͕ྑ͍ ‣

    Interceptor ͕࢖͑Δ ‣ Go ޲͚ͷ gRPC Ecosystem middleware ͕ଟ͍ ‣ ͲͪΒ΋੩తܕ෇͚
  15. gRPC gRPC with Go ‣ gRPC ͱ Go ͸૬ੑ͕ྑ͍ ‣

    Interceptor ͕࢖͑Δ ‣ Go ޲͚ͷ gRPC Ecosystem middleware ͕ଟ͍ ‣ ͲͪΒ΋੩తܕ෇͚ ‣ Go Ͱαʔό͕ॻ͚Δتͼ
  16. gRPC

  17. gRPC Demerits of gRPC ‣ REST ʹൺ΂ͯखಈͷςετ͕໘౗ ‣ ͪΐͬͱͨ࣌͠ʹ curl

    ͰςετͰ͖ͳ͍
  18. gRPC Demerits of gRPC ‣ REST ʹൺ΂ͯखಈͷςετ͕໘౗ ‣ ͪΐͬͱͨ࣌͠ʹ curl

    ͰςετͰ͖ͳ͍ ‣ grpc-ecosystem/polyglot ‣ ൚༻త͗ͯ͢࢖͍ͮΒ͍ ‣ Java ͳͷͰ JVM ͷىಈʹ͕͔͔࣌ؒΔ
  19. Let’s make it myself

  20. lycoris0731/evans

  21. lycoris0731/evans ʊਓਓਓਓਓਓʊ ʼɹ։ൃ్தɹʻ ʉ:?:?:?:?:ʉ

  22. Evans Overview of Evans ‣ Go ੡ͷ Universal gRPC Client

    ‣ Interactive (REPL) Ϟʔυ ‣ ର࿩తʹ message Λೖྗ ‣ ಈతͳิ׬ػೳ ‣ Non-interactive (CLI) Ϟʔυ ‣ UNIX ఩ֶʹଇΔ
  23. Evans Mechanism ‣ proto ϑΝΠϧΛಡΈࠐΈ ‣ Services / Methods /

    Messages Λऔಘ ‣ Message ͷϑΟʔϧυΛऔಘ ‣ ֤ϑΟʔϧυΛೖྗͤ͞Δ ‣ DynamicMessage Λར༻ͯ͠ Message Λ૊ΈཱͯΔ ‣ Remote procedure call
  24. Evans Mechanism ‣ proto ϑΝΠϧΛಡΈࠐΈ ‣ Services / Methods /

    Messages Λऔಘ ‣ Message ͷϑΟʔϧυΛऔಘ ‣ ֤ϑΟʔϧυΛೖྗͤ͞Δ ‣ DynamicMessage Λར༻ͯ͠ Message Λ૊ΈཱͯΔ ‣ Remote procedure call
  25. Evans Mechanism ‣ go-protobuf ʹ͸ DynamicMessage ͕ͳ͍ ‣ Go Ͱ͍͏

    reflect ‣ jhump/protoreflect Λར༻
  26. demo

  27. CLI References ‣ GoݴޠͰςετ͠΍͍͢ίϚϯυϥΠϯπʔϧΛͭ͘Δ (http://deeeet.com/writing/2014/12/18/golang-cli-test/) ‣ GoݴޠʹΑΔCLIπʔϧ։ൃͱUNIX఩ֶʹ͍ͭͯ (http://blog.yuuk.io/entry/go-cli-unix) ‣ UNIX

    ͱ͍͏ߟ͑ํ —ͦͷઃܭࢥ૝ͱ఩ֶ