dtw52353 2016-08-19 08:09
浏览 828
已采纳

Golang的net / rpc软件包和gRPC框架有什么区别?

gRPC is a "general RPC framework" which uses ProtoBuffer to serialize and deserialize while the net/rpc package seems could do "nearly" the same thing with encoding/gob and both are under the umbrella of Google.
So what's the difference between them? What pros and cons dose choosing one of them have?

  • 写回答

1条回答 默认 最新

  • doujiena0025 2016-08-19 08:37
    关注

    Well, you have said it yourself. gRPC is a framework that uses RPC to communicate. RPC is not Protobuf but instead Protobuf can use RPC and gRPC is actually Protobuf over RPC.

    You don't need to use Protobuf to create RPC services within your app. This is a good idea if you are doing libraries/apps from small to medium size. Also you don't need to learn the syntax of Protobuf to create your own services.

    But, Protobuf is much faster than REST. It is a much more convenient way to communicate with the downside of the learning curve of the Protobuf syntax. Also, you can use Protobuf to generate the codebase in more languages than simply Go. So if you have some kind of service in Java, you can use Protobuf to generate RPC calls between them easily while if you use the net/rpc package you'll have to implement them twice (once in Go and once in Java)

    In general, I will use Protobuf to nearly all. This gives you confidence to use it at more large scale or complex projects.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度