spring-cloud/spring-cloud-gateway

Ability to disable connection pooling on route level

Open

#2,418 opened on Oct 27, 2021

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Java (3,204 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (4,284 stars)
PR merge metrics
 (Avg merge 1d 21h) (18 merged PRs in 30d)

Description

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.

Contributor guide