spring-cloud/spring-cloud-gateway

Ability to disable connection pooling on route level

Open

#2418 aperta il 27 ott 2021

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Java (3204 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (4284 star)
Metriche merge PR
 (Merge medio 1g 21h) (18 PR mergiate in 30 g)

Descrizione

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.

Guida contributor