You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Envoy中实现单TCP连接承载5个gRPC流

问题:gRPC+Envoy下TCP流超6个后Pending的解决需求

我拥有gRPC服务和Envoy代理网关。

架构示意图

主要问题是当我尝试建立超过6个TCP流时,其余所有流都处于pending状态:

TCP流Pending状态示意图

我理解这是因为浏览器存在TCP连接限制,因此寻求在1个TCP连接上建立5个流的可行方案。

当前Envoy配置(envoy.yaml)

static_resources:
  listeners:
  - name: grpc
    address:
      socket_address: { address: 0.0.0.0, port_value: 8080 }
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          codec_type: AUTO
          stat_prefix: ingress_http
          stream_idle_timeout: 0s
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match: { prefix: "/ligric.protobuf.UserApis" }
                route: { cluster: userapis_service, timeout: 0s }
              cors:
                allow_origin_string_match:
                    - exact: http://127.0.0.1:5000
                allow_methods: GET, PUT, DELETE, POST, OPTIONS
                allow_headers: grpc-accept-encoding,content-type,origin,referer,authorization,keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web
                expose_headers: grpc-status,grpc-message,x-envoy-upstream-service-time,custom-header-1
                max_age: "1728000"
          http_filters:
          - name: envoy.filters.http.cors
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors
          - name: envoy.filters.http.grpc_web
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

  clusters:
  # Apis
  - name: userapis_service
    type: logical_dns
    lb_policy: round_robin
    dns_lookup_family: V4_ONLY
    connect_timeout: 0.25s
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicit_http_config:
          http2_protocol_options: {}
    load_assignment:
      cluster_name: grpc
      endpoints:
        - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: host.docker.internal
                    port_value: 50052

内容的提问来源于stack exchange,提问作者limeniye

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 14:05:23