gRPC

gRPC发布了1.0(gRPC-go)

Go Web Framework: beego/eProsima Fast Buffer

任何RPC协议来说,最重要的两个因素是内容交互格式和传输协议。

  • 内容交换格式: grpc 采用的protocol buffer,开源已久,序列化和反序列化的速度都比thrift还要稍微好点的。

  • 传输协议:gRPC采用了HTTP/2, 性能比http1.1好的不是一星半点啊。HTTP//2的多路复用,头压缩都好了很多,性能杠杠的。从开放性上来说,比thrift那私有的协议后期更好做性能优化,缓存,集群,都更好做些。

Terminology

  1. gRPC is built on HTTP/2, which explicitly supports full-duplex streams, which means that the client can upload request data at the same time the server is sending back response data. This is very powerful and eliminates the need for things like web sockets, which is an extension of HTTP 1.1, to allow full-duplex communication over an HTTP 1.1 connection.

  2. Channels represent virtual connections to an endpoint, which in reality may be backed by many HTTP/2 connections

  3. load balancing with connection pooling for gRPC-go/thread model

  4. The design goals of Protobuf were simplicity and speed.

  5. how gRPC works under the hood <gRPC的工作原理> : protoc -I proto/ proto/order_management.proto --go_out=plugins=grpc:order/ecommerce

  6. gRPC相对于RESTful协议的优势,这里我列一下:

    1. 使用高效的protobuf作为协议payload,节约网络带宽

    2. 多语言框架集成,通过Java、Go等语言的静态类型特性,直接避免了拼写错误等问题

    3. 方便扩展接入,如果需要对一个第三方组件进行扩展,只要一个.proto文件,就自动得到了一个脚手架

  7. dd

References

  1. gRPC:Google开源的基于HTTP/2和ProtoBuf的通用RPC框架

  2. capnproto

  3. Is gRPC the Future of Client-Server Communication?

  4. Sending files via gRPC

  5. GRPC Adoption and Working Architecture

  6. 思考gRPC :为什么是HTTP/2

  7. Envoy and gRPC-Web: a fresh new alternative to REST

  8. Understanding gRPC (thread model)
  9. gRPC On HTTP/2: Engineering A Robust, High Performance Protocol
  10. gRPC vs HTTP APIs
  11. REST over gRPC with grpc-gateway for Go
  12. Supercharge your REST APIs with Protobuf
  13. Understanding gRPC and implementing a practical application in Go and Python
  14. gRPC in Golang 2019
  15. gRPC Up and Running source code
  16. Understanding gRPC

results matching ""

    No results matching ""