diff --git a/docs/root/intro/arch_overview/other_protocols/grpc.rst b/docs/root/intro/arch_overview/other_protocols/grpc.rst index 01275183b155..ea4c637ad991 100644 --- a/docs/root/intro/arch_overview/other_protocols/grpc.rst +++ b/docs/root/intro/arch_overview/other_protocols/grpc.rst @@ -3,78 +3,35 @@ gRPC ==== -`gRPC `_ is an RPC framework from Google. It uses protocol buffers as the -underlying serialization/IDL format. At the transport layer it uses HTTP/2 for request/response -multiplexing. Envoy has first class support for gRPC both at the transport layer as well as at the -application layer: +`gRPC `_ 是来自 Google 的 RPC 框架。它使用 protocol buffers 作为底层序列化/IDL(接口描述语言)格式。在传输层,它使用 HTTP/2 进行请求/响应复用。Envoy在传输层和应用层都提供对 gRPC 一流的支持: -* gRPC makes use of HTTP/2 trailers to convey request status. Envoy is one of very few HTTP proxies - that correctly supports HTTP/2 trailers and is thus one of the few proxies that can transport - gRPC requests and responses. -* The gRPC runtime for some languages is relatively immature. See :ref:`below ` - for an overview of filters that can help bring gRPC to more languages. -* gRPC-Web is supported by a :ref:`filter ` that allows a gRPC-Web - client to send requests to Envoy over HTTP/1.1 and get proxied to a gRPC server. It's under - active development and is expected to be the successor to the gRPC :ref:`bridge filter - `. -* gRPC-JSON transcoder is supported by a :ref:`filter ` - that allows a RESTful JSON API client to send requests to Envoy over HTTP and get proxied to a - gRPC service. +* gRPC 使用 HTTP/2 trailers 来传送请求状态。 Envoy 是能够正确支持 HTTP/2 trailers 的少数几个 HTTP 代理之一,因此也是少数可以传输 gRPC 请求和响应的代理之一。 +* 某些语言的 gRPC 运行时相对不成熟。有关 gRPC 引入更多语言的过滤器的概述请参见 :ref:`桥接过滤器 `。 +* gRPC-Web 由一个指定的 :ref:`过滤器 ` 支持,该过滤器允许 gRPC-Web 客户端通过 HTTP/1.1 向 Envoy 发送请求并代理到 gRPC 服务器。目前相关团队正在积极开发中,预计它将成为 gRPC :ref:`桥接过滤器 ` 的后续产品。 +* gRPC-JSON 转码器由一个指定的 :ref:`过滤器 ` 支持,该过滤器允许 RESTful JSON API 客户端通过 HTTP 向 Envoy 发送请求并获取代理到 gRPC 服务。 .. _arch_overview_grpc_bridging: -gRPC bridging +gRPC 桥接 ------------- -Envoy supports two gRPC bridges: +Envoy 支持两种 gRPC 桥接过滤器: -* :ref:`grpc_http1_bridge filter ` which allows gRPC requests to be sent to Envoy over - HTTP/1.1. Envoy then translates the requests to HTTP/2 for transport to the target server. The response is translated back to HTTP/1.1. - When installed, the bridge filter gathers per RPC statistics in addition to the standard array of global HTTP statistics. -* :ref:`grpc_http1_reverse_bridge filter ` which allows gRPC requests to be sent to Envoy - and then translated to HTTP/1.1 when sent to the upstream. The response is then converted back into gRPC when sent to the downstream. - This filter can also optionally manage the gRPC frame header, allowing the upstream to not have to be gRPC aware at all. +* :ref:`gRPC HTTP/1.1 桥接过滤器 ` 允许将 gRPC 请求通过 HTTP/1.1 发送到 Envoy。然后,Envoy 将请求转换为 HTTP/2 传输到目标服务器。响应则被转换回 HTTP/1.1。安装后,桥接过滤器除了收集标准的全局 HTTP 统计数据外,还收集每个 RPC 的统计数据。 +* :ref:`gRPC HTTP/1.1 反向桥接过滤器 ` 允许将 gRPC 请求发送到 Envoy,然后在发送到上游时转换为 HTTP/1.1。在发送到下游时,响应又被转换回 gRPC。该过滤器还可以选择性地管理 gRPC 帧头,这样一来,上游就完全不用知道 gRPC 了。 .. _arch_overview_grpc_services: -gRPC services +gRPC 服务 ------------- -In addition to proxying gRPC on the data plane, Envoy makes use of gRPC for its -control plane, where it :ref:`fetches configuration from management server(s) -` and in filters, such as for :ref:`rate limiting -` or authorization checks. We refer to these as -*gRPC services*. +Envoy 除了在数据平面上代理 gRPC 外,在控制平面上也使用了 gRPC,在控制平面上,它从中 :ref:`获取管理服务器的配置 ` 以及过滤器的配置,例如将其用于 :ref:`限流 ` 或授权检查。我们称之为 *gRPC 服务*。 -When specifying gRPC services, it's necessary to specify the use of either the -:ref:`Envoy gRPC client ` or the -:ref:`Google C++ gRPC client `. We -discuss the tradeoffs in this choice below. +当指定 gRPC 服务时,必须指定使用 :ref:`Envoy gRPC 客户端 ` 或 :ref:`Google C++ gRPC 客户端 `。 我们在下面讨论这种选择的权衡。 -The Envoy gRPC client is a minimal custom implementation of gRPC that makes use -of Envoy's HTTP/2 upstream connection management. Services are specified as -regular Envoy :ref:`clusters `, with regular -treatment of :ref:`timeouts, retries `, endpoint -:ref:`discovery `/:ref:`load -balancing/failover `/load reporting, :ref:`circuit -breaking `, :ref:`health checks -`, :ref:`outlier detection -`. They share the same :ref:`connection pooling -` mechanism as the Envoy data plane. Similarly, cluster -:ref:`statistics ` are available for gRPC services. -Since the client is minimal, it does not include advanced gRPC features such as -`OAuth2 `_ or `gRPC-LB -`_ lookaside. +Envoy gRPC 客户端是 gRPC 的最小自定义实现,它使用 Envoy 的 HTTP/2 上游连接管理。服务被指定为常规的 Envoy :ref:`集群 `,并定期处理 :ref:`超时、重试 `、端点 :ref:`发现 `、:ref:`负载均衡/故障转移 `、负载报告、:ref:`熔断 `、:ref:`健康检查 `、:ref:`异常检测 `。它们与 Envoy 的数据面共享相同的 :ref:`连接池 ` 机制。同样,集群 :ref:`统计信息 ` 用于 gRPC 服务。由于客户端是简化版的 gRPC 实现,因此不包括诸如 `OAuth2 `_ 或 `gRPC-LB `_ 之类的高级 gRPC 功能后备。 -The Google C++ gRPC client is based on the reference implementation of gRPC -provided by Google at https://github.com/grpc/grpc. It provides advanced gRPC -features that are missing in the Envoy gRPC client. The Google C++ gRPC client -performs its own load balancing, retries, timeouts, endpoint management, etc, -independent of Envoy's cluster management. The Google C++ gRPC client also -supports `custom authentication plugins -`_. +Google C++ gRPC 客户端的实现是基于 Google 在 https://github.com/grpc/grpc 上提供的 gRPC 参考。它提供了 Envoy gRPC 客户端中缺少的高级 gRPC 功能。Google C++ gRPC 客户端独立于 Envoy 的集群管理,执行自己的负载平衡、重试、超时、端点管理等。Google C ++ gRPC客户端还支持 `自定义身份认证插件 `_。 + +在大多数情况下,当你不需要 Google C++ gRPC 客户端的高级功能时,建议使用 Envoy gRPC 客户端。这使得配置和监控更加简单。如果 Envoy gRPC 客户端中缺少你所需要的功能,则应该使用 Google C++ gRPC 客户端。 -It is recommended to use the Envoy gRPC client in most cases, where the advanced -features in the Google C++ gRPC client are not required. This provides -configuration and monitoring simplicity. Where necessary features are missing -in the Envoy gRPC client, the Google C++ gRPC client should be used instead.