spring-boot: First request with WebClient slower in Spring Boot 2.4.0 compared to Spring Boot 2.3.6.RELEASE

Make a project with the dependency spring-boot-starter-webflux. Add the following simple test:

@SpringBootTest
class SlowWebClientTest {
    @Autowired
    WebClient.Builder builder;

    @Test
    void getRequest() {
        var client = builder.build();
        var body = client.get()
                .uri("https://reqres.in/api/users/1")
                .retrieve()
                .toBodilessEntity();
        StepVerifier.create(body).expectNextCount(1).verifyComplete();
    }
}
  • With Spring Boot 2.4.0 it takes over 7.5 seconds to run this test.
  • With Spring Boot 2.3.6.RELEASE it takes under 2.5 seconds to run this test.

I ran the test multiple times with both versions of Spring Boot.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (17 by maintainers)

Most upvoted comments

@hansdesmet Can you please try the two experiments I suggested above:

  1. The modified test that removes Spring Boot from the picture at runtime
  2. The original test with debug logging enabled

Comparing the timings and output of both with 2.3.6 and 2.4.0 may help to shed some light on the point at which the delay is occurring.

@hansdesmet I tested on a VM with Windows 10, IntelliJ IDEA 2020.2.3 and adopt-openjdk-11.0.9.1 and I also do not see difference between 2.3.6 and 2.4.0

Can you try to run with this property -Dio.netty.handler.ssl.noOpenSsl=true as you do not have OpenSSL on your system?