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

gRPC e Go um passo antes

gRPC e Go um passo antes

Esta apresentação tenta mostrar um pouco da história dos protocolos HTTP e como funciona sobre as camadas de TCP e UDP. Demostrando sua evolução até chegarmos no SPDY, QUIC e HTTP/3.
Fazemos um apanhando no rEST utilizando HTTP/1, HTTP/2 e finalmente mostramos o RPC utilizando TCP e UDP.
Agora aprender gRPC ficou mais fácil, depois de todo este embasamento demostramos o funcionamento do gRPC e como podemos tirar proveito de sua utilização.

02b3f64a1d67d061c3be08729322a90b?s=128

Jefferson Otoni Lima

July 22, 2020
Tweet

Transcript

  1. http://s3wf.com @jeffotoni Meetup Golang Campinas Jefferson Otoni RPC, gRPC &

    Go
  2. Senior Software Engineer Jefferson Otoni Lima

  3. None
  4. @jeffotoni Comunidade Telegram https://t.me/go_br https://t.me/go_bh https://t.me/golangcwb Slack https://gophers.slack.com (members >~45k)

    GopherCon Brasil 2020 https://2020.gopherconbr.org Wiki Conferencias https://github.com/golang/go/wiki/Conferences Meetup https://www.meetup.com/go-belo-horizonte https://www.meetup.com/pt-BR/golangbr https://www.meetup.com/pt-BR/Women-Who-Go-Sampa https://www.meetup.com/pt-BR/Golang-Campinas/ https://www.meetup.com/pt-BR/golang-poa/ https://www.meetup.com/pt-BR/GolangCWB/
  5. @jeffotoni https://golang.org https://golang.org/doc/effective_go.html https://golang.org/ref/spec https://golang.org/doc https://tour.golang.org/welcome/1

  6. @jeffotoni WEB Protocolos

  7. @jeffotoni HTTP/1.1 TCP TCP UDP protocolos HTTP/2.0 SPDY HTTP/3 QUIC

    SPDY QUIC
  8. @jeffotoni HTTP Versões HTTP/0.9 1991; one method HTTP/1.0 1996; headers,

    caching, languages HTTP/1.1 1999; keepalives, upgrades, ranges, hosts SPDY 2009; one tcp, gzip headers, flow control QUIC 2012; UDP, handshake, baixa latência HTTP/2.0 2015; HPACK, priorities, server push HTTP/3.0 2019; no head-of-line blocking,TLS 1.3
  9. @jeffotoni HTTP/3.0 Um bolo de camada HTTP / 3 Fonte:

    https://blog.cloudflare.com/http-3-from-root-to-tip/
  10. @jeffotoni HTTP/2.0 . Multiplexing . Bidirectional Streaming . HTTPS .

    SSL/TLS . Token auth . Channel credentials . Performance
  11. @jeffotoni HTTP/3.0 HTTP/2 vs HTTP/3 Fonte: https://kinsta.com/pt/blog/http3

  12. @jeffotoni

  13. HTTP/2.0 $ curl -I -L https://app.guula.com.br HTTP/2 200 server: nginx/1.14.0

    (Ubuntu) date: Wed, 22 Jul 2020 17:33:15 GMT content-type: text/html; charset=utf-8 vary: Origin @jeffotoni
  14. HTTP/2.0 @jeffotoni

  15. @jeffotoni

  16. @jeffotoni HTTP/3.0

  17. HTTP/3.0

  18. Back-end

  19. serviços/protocolos @jeffotoni RPC TCP/UDP/http REST http SOAP http xml-RPC http

    RMI tcp Representational State Transfer Remote Procedure Call Simple Object Access Protocol Remote Method Invocation webSocket http/tcp comunicação bidirecional por canais full-duplex e usa o schema: ws:// ou wss://
  20. (Representational State Transfer) rEST

  21. /auth POST /user GET /user/{uuid} GET /user/{uuid} DELETE /user/{uuid} PUT

    1M requests/s 50k requests/s 100k requests/s 60k requests/s 1k requests/s service 1 service 2 service 3 service 4 service 5
  22. @jeffotoni Api rEST em Go - Endpoints - Middleware -

    Instrumentar - Dockerfile - Deploy
  23. Serializion

  24. . encoding/json . encoding/xml . github.com/tinylib/msgp . github.com/golang/protobuf . github.com/gogo/protobuf

    . Apache/Thrift . Apache/Avro . gotiny . vmihailenco/msgpack/v4 Alguns tipos de serializações
  25. Serializion MessagePack

  26. @jeffotoni Api rEST em Go - Endpoints - Middleware -

    Instrumentar - Dockerfile - Deploy
  27. /user/{uuid} GET /user/{uuid} PUT 100k requests/s 1k requests/s service 3

    service 5 HTTP + JSON
  28. service3 service5 HTTP rEST rEST CLIENT

  29. RPC (Remote Procedure Call) procedimentos remotos como se fossem chamadas

    locais
  30. (Remote Procedure Call) RPC server

  31. /user/{uuid} GET /user/{uuid} PUT 100k requests/s 1k requests/s service 3

    service 5 RPC RPC SERVER RPC CLIENT
  32. RPC server Go - Struct Args - Struct User -

    Metodo Get @jeffotoni
  33. RPC server Go - Register - Metodos - Instrumentar -

    Dockerfile - Deploy @jeffotoni
  34. RPC server Go - Register - Metodos - Instrumentar @jeffotoni

  35. (Remote Procedure Call) RPC client

  36. RPC client Go - Conexao - Args/param - Reply/Retorno -

    Dockerfile - Deploy @jeffotoni
  37. Service3 Service5 TCP RPC RPC SERVER HTTP rEST RPC CLIENT

  38. nível de modularidade microservice

  39. None
  40. gRPC

  41. Protocol Buffers protobuf-compiler

  42. Protocol Buffers $ protoc --go_out=. produto.proto

  43. None
  44. Metodos

  45. Go Marshal

  46. Go Unmarshal

  47. /user/{uuid} GET /user/{uuid} PUT 100k requests/s 1k requests/s service 3

    service 5 gRPC gRPC SERVER gRPC CLIENT
  48. referências https://jobs.kenoby.com/engineering https://golang.org https://grpc.io/docs/tutorials/basic/go https://github.com/grpc/grpc-go/tree/master/examples https://developers.google.com/protocol-buffers/docs/gotutorial https://github.com/uw-labs/bloomrpc (curl ou posltman

    para grpc) https://itnext.io/learning-go-mongodb-crud-with-grpc-98e425aeaae6 https://encurtador.com.br/fHKSU https://encurtador.com.br/eqvJ2 https://gokit.io/examples/ https://github.com/smallnest/gosercomp https://easyengine.io/tutorials/nginx/configuring-http-2-server-push https://www.digitalocean.com/community/tutorials/http-1-1-vs-http-2-what-s-the-difference https://medium.com/@factoryhr/http-2-the-difference-between-http-1-1-benefits-and-how-to-use-it-38094fa0e95b https://blog.cloudflare.com/how-to-test-http-3-and-quic-with-firefox-nightly/ https://blog.cloudflare.com/http-3-vs-http-2 https://kinsta.com/blog/http3 https://blog.cloudflare.com/http3-the-past-present-and-future links
  49. Thanks := &Obrigado{...} Obrigado... github.com/jeffotoni instagram.com/jeffotoni https://t.me/devopsbh https://t.me/go_br https://t.me/awsbrasil linkedin.com/in/jeffotoni/