title: Spring Boot WebClient OAuth - Got timeout when hit multiple request in same time
body: <p>I'm using spring boot (2.4.4) with webflux and oauth2-client, My code is success get from API server, when I hit using postman got response time around 500ms per hit. But when I hit with 10-100 data in same time using jMeter it cause error timeout. Is my code wrong or I miss something in my code?</p>
  <p>Here is my OAuth config:</p>
  <pre><code>@Bean
  public ReactiveOAuth2AuthorizedClientManager authorizedClientManager(ReactiveClientRegistrationRepository clientRegistrationRepository, ReactiveOAuth2AuthorizedClientService authorizedClientService) {
      ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider = ReactiveOAuth2AuthorizedClientProviderBuilder.builder().clientCredentials().authorizationCode().refreshToken().build();
  
      AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager authorizedClientManager = new AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(clientRegistrationRepository, authorizedClientService);
      authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider);
      return authorizedClientManager;
  }
  
  @Bean
  public WebClient webClient(ReactiveOAuth2AuthorizedClientManager authorizedClientManager) {
      ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager);
      oauth.setDefaultClientRegistrationId(&quot;custom-registrationId&quot;);
  
      WebClient.Builder builder = WebClient.builder();
      builder.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
      builder.filter(oauth);
      return builder.build();
  }
  </code></pre>
  <p>The impementation on my webclient are using block, because I need to parsing the response from API before send to the client</p>
  <pre><code>@Autowired
  private WebClient webClient;
  
  String response = webClient.post()
      .uri(URL_API)
      .bodyValue(jsonRequest)
      .exchangeToMono(clientResponse -&gt; clientResponse.bodyToMono(String.class))
      .timeout(Duration.ofMillis(10000))
      .share().block();
  </code></pre>
  <p>The problem is when I using jMeter. When i hit directly to API server everything is success, but not when through my Application</p>
  <pre><code>reactor.core.Exceptions$ReactiveException: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 10000ms in 'flatMap' (and no fallback has been configured)
  </code></pre>