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

Microservice with go and gRPC

Microservice with go and gRPC

2018 GDG DevFest - go와 gRPC로 함께하는 마이크로서비스

Eunju Amy Sohn

November 05, 2018
Tweet

More Decks by Eunju Amy Sohn

Other Decks in Programming

Transcript

  1. - What is gRPC? - Let s make it! (a.k.a

    coding time) - gRPC features - Why Microservice? - Summary Korea
  2. History of Server - Client communication Socket RPC CORBA DCOM

    SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~
  3. History of Server - Client communication Socket RPC CORBA DCOM

    SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ ?
  4. History of Server - Client communication Socket RPC CORBA DCOM

    SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ Socket .
  5. History of Server - Client communication Socket RPC CORBA DCOM

    SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ RPC .. !
  6. History of Server - Client communication Socket RPC CORBA DCOM

    SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ HTTP . SOAP - XML REST - ( )JSON
  7. History of Server - Client communication Socket RPC CORBA DCOM

    SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ HTTP . SOAP - XML REST - ( )JSON
  8. How it works gRPC • Stub • IDL (Interface Description

    Language) - - Stub • Protocol Buffers
  9. How it works gRPC • Stub • IDL (Interface Description

    Language) • Protocol Buffers - (serialization) - IDL stub service interface code
  10. gRPC service outline API - Unary RPC Model (User) -

    name, age, cache API - cache - cache User Server lang - go Client lang - python
  11. Go • google • Docker, Kubernetes, Packer • • gRPC

    gRPC tool ( https:// github.com/grpc-ecosystem/ awesome-grpc )
  12. Proto3 Protocol buffers language Version: proto2(default) & proto3 Service Message

    type Service field type generally scalar, enum or other message types filed number message .
  13. Context in golang For deadlines, cancelation, and requested-scoped values -

    - cancelation goroutine? - go - Dave Cheny Never start a goroutine without knowing how it will stop
  14. Diagram RPC with goroutine & channel Diagram - 1 Client

    Server 1 Request Response Server 2 Request Response
  15. gRPC tips .proto - - git submodule .proto message -

    Load balancing - low-latency gRPC client-side LB
  16. gRPC Pros 2. .. • HTTP/2 default, binary data, header

    compression, cancellation propagation • Google App Engine n1-highcpu-16 CPU 11
  17. Go s http request multiplexer Content-type base routing application/grpc ->

    direct grpc else -> grpc-gateway https://github.com/grpc- ecosystem/grpc-gateway
  18. why gRPC is good at Microservice? Microservice gRPC • •

    • gRPC network latency • typing/versioning •
  19. Resources References & Resources • reference tutorial Github . •

    https://github.com/EJSohn/microservice-with-go-and-grpc