gRPC(HTTP / 2)比使用HTTP / 2的REST更快吗? [英] Is gRPC(HTTP/2) faster than REST with HTTP/2?
问题描述
我们的目标是引入传输层和应用层协议,它的延迟和网络吞吐量更好。目前,该应用程序对 HTTP / 1.1 使用 REST ,并且我们遇到了高延迟。我需要解决这个延迟问题,我打算使用 gRPC(HTTP / 2)或 REST / HTTP2 。
HTTP / 2:
- 多路复用
- TCP连接
- 二进制代替文本
- 标题压缩
- 服务器推送
我知道所有上述优点。 问题1:如果我使用 REST与HTTP / 2 ,我相信,与使用HTTP / 1.1的 REST相比,我将获得显着的性能提升,但它与 gRPC(HTTP / 2)相比如何?
我也知道gRPC使用proto缓冲区,这是在线路上传输结构化数据的最佳二进制序列化技术。 Proto缓冲区也有助于开发语言不可知的方法。我同意这一点,我可以使用graphQL在REST中实现相同的功能。但我担心的是序列化问题:问题2: HTTP / 2 实现此二进制功能时,使用proto缓冲区会带来额外的优势在HTTP / 2之上?问题3:流媒体,双向使用案例,gRPC HTTP / 2)与(REST和HTTP / 2)进行比较?
互联网上有很多博客/视频 (HTTP / 2)与(REST和HTTP / 1.1),如这个。如前所述,我想知道在比较GRPC(HTTP / 2)和(REST与HTTP / 2)方面的差异和好处。 默认情况下,gRPC不比HTTP / REST更快,但它为您提供了更快的工具。有些事情对于REST来说很难或不可能做到。 nfirvine说,使用Protobuf你会看到你的大部分性能改进。虽然您可以使用REST使用proto,但它与gRPC很好地结合在一起。从技术上讲,你可以在gRPC上使用JSON,但大多数人不希望在习惯protos后支付性能成本。 The goal is to introduce a transport and application layer protocol that is better in its latency and network throughput. Currently, the application uses REST with HTTP/1.1 and we experience a high latency. I need to resolve this latency problem and I am open to use either gRPC(HTTP/2) or REST/HTTP2. HTTP/2: I am aware of all the above advantages. Question No. 1: If I use REST with HTTP/2, I am sure, I will get a significant performance improvement when compared to REST with HTTP/1.1, but how does this compare with gRPC(HTTP/2)? I am also aware that gRPC uses proto buffer, which is the best binary serialization technique for transmission of structured data on the wire. Proto buffer also helps in developing an language agnostic approach. I agree with that and I can implement the same feature in REST using graphQL. But my concern is over serialization: Question No. 2: When HTTP/2 implements this binary feature, does using proto buffer give an added advantage on top of HTTP/2? Question No. 3: In terms of streaming, bi-directional use-cases, how does gRPC(HTTP/2) compare with (REST and HTTP/2)? There are so many blogs/videos out in the internet that compares gRPC(HTTP/2) with (REST and HTTP/1.1) like this. As stated earlier, I would like to know the differences, benefits on comparing GRPC(HTTP/2) and (REST with HTTP/2). gRPC is not faster than REST over HTTP/2 by default, but it gives you the tools to make it faster. There are some things that would be difficult or impossible to do with REST. As nfirvine said, you will see most of your performance improvement just from using Protobuf. While you could use proto with REST, it is very nicely integrated with gRPC. Technically, you could use JSON with gRPC, but most people don't want to pay the performance cost after getting used to protos. 这篇关于gRPC(HTTP / 2)比使用HTTP / 2的REST更快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!