spring-cloud/spring-cloud-gateway

Ability to disable connection pooling on route level

Open

#2,418 创建于 2021年10月27日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)Java (3,204 fork)batch import
enhancementhelp wanted

仓库指标

Star
 (4,284 star)
PR 合并指标
 (平均合并 1天 21小时) (30 天内合并 18 个 PR)

描述

Is your feature request related to a problem? Please describe. These days k8s is a popular solution. In the default setup typical communication looks like this: http client with connection pooling -> Kubernetes Service (which is implemented by kube-proxy - L4 load balancer) -> http server. Connection pooling + L4 Load Balancing isn't an optimal combination. Traffic can be unevenly distributed accross instances. Implementing L7 Load Balancer (through service mesh) can be costly.

Describe the solution you'd like Ability to set up a pool mode (or just a flag - disabled/enabled) in route's metadata just like netty's connect-timeout / response-timeout. Eg. pool-mode?

Describe alternatives you've considered

  1. Setting up SetRequestHeader=Connection, Close on route, which can effectively disable connection pooling. Unfortunately this doesn't work because of RemoveHopByHop Headers Filter. It truncates Connection header event if it's added by configuration. Anyway - i'm not 100% sure if adding this header has under the hood exactly the same effect as just disabling connection pooling on http client.
  2. Setting up Connection header by upstream in a response. But also as in alternative above i don't know if this doesn't causes another issues related to http pipelining etc.
  3. Configuring ribbon in pod-communication mode. But we want to avoid that, because there is some eventual consistency between pod's state local copy in gateway and actual state, which causes sending requests to already dead pods during upstream rollout.

贡献者指南