spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Advanced WebClient Pool Configuration via `application.yaml`

Open palprat opened this issue 10 months ago • 0 comments

Currently, Spring Cloud Gateway exposes only basic HttpClient settings via application.yaml, such as:

spring:
  cloud:
    gateway:
      httpclient:
        connect-timeout: 5000
        response-timeout: 60s

However, Reactor Netty’s ConnectionProvider supports several advanced settings that are not exposed in the Spring Cloud Gateway configuration layer. These include:

          use-global-resources: false
    

Use Case These settings are critical for controlling connection reuse behavior in environments with:

Strict keep-alive or idle timeout policies (e.g., ALB, firewalls)

High-throughput microservices with connection pooling requirements

Custom tuning of backend interactions to avoid stale connection reuse

Currently, the only way to configure these is via Java configuration by injecting a ConnectionProvider manually.

Request Please expose these advanced connection pool properties (from ConnectionProvider.Builder) through Spring Boot configuration metadata so they can be safely used in application.yaml or application.properties.

This would greatly simplify configuration in Spring Cloud Gateway and align it more closely with the capabilities of Reactor Netty.

Related Discussions StackOverflow threads discussing this limitation

Issues about idle connection reuse causing errors

Spring Cloud Version Tested with: Spring Cloud 2023.x, Spring Boot 3.x

Thanks for considering this enhancement!

palprat avatar May 27 '25 13:05 palprat