title: Ribbon load balancer with webclient differs from rest template one (not properly balanced)
body: <p>I've tried to use <code>WebClient</code> with <code>LoadBalancerExchangeFilterFunction</code>:</p>
  
  <p><code>WebClient</code> config:</p>
  
  <pre><code>@Bean
  public WebClient myWebClient(final LoadBalancerExchangeFilterFunction lbFunction) {
      return WebClient.builder()
              .filter(lbFunction)
              .defaultHeader(ACCEPT, APPLICATION_JSON_VALUE)
              .defaultHeader(CONTENT_ENCODING, APPLICATION_JSON_VALUE)
              .build();
  } 
  </code></pre>
  
  <p>Then I've noticed that calls to underlying service are not properly load balanced - there is constant difference of RPS on each instance.</p>
  
  <p>Then I've tried to move back to <code>RestTemplate</code>. And it's working fine.</p>
  
  <p>Config for <code>RestTemplate</code>:</p>
  
  <pre><code>private static final int CONNECT_TIMEOUT_MILLIS = 18 * DateTimeConstants.MILLIS_PER_SECOND;
  private static final int READ_TIMEOUT_MILLIS = 18 * DateTimeConstants.MILLIS_PER_SECOND;
  
  @LoadBalanced
  @Bean
  public RestTemplate restTemplateSearch(final RestTemplateBuilder restTemplateBuilder) {
      return restTemplateBuilder
              .errorHandler(errorHandlerSearch())
              .requestFactory(this::bufferedClientHttpRequestFactory)
              .build();
  }
  
  private ClientHttpRequestFactory bufferedClientHttpRequestFactory() {
      final SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
      requestFactory.setConnectTimeout(CONNECT_TIMEOUT_MILLIS);
      requestFactory.setReadTimeout(READ_TIMEOUT_MILLIS);
      return new BufferingClientHttpRequestFactory(requestFactory);
  }
  
  private ResponseErrorHandler errorHandlerSearch() {
      return new DefaultResponseErrorHandler() {
          @Override
          public boolean hasError(ClientHttpResponse response) throws IOException {
              return response.getStatusCode().is5xxServerError();
          }
      };
  }
  </code></pre>
  
  <p>Load balancing using <code>WebClient</code> config up to 11:25, then switching back to <code>RestTemplate</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/Ca2zE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ca2zE.png" alt="web-client-vs-rest-template-load-balancing"></a></p>
  
  <p>Is there a reason why there is such difference and how I can use <code>WebClient</code> to have same amount of RPS on each instance? Clue might be that older instances are getting more requests than new ones. </p>
  
  <p>I've tried bit of debugging and same (defaults like <code>ZoneAwareLoadBalancer</code>) logic is being called. </p>