title: How to orginize thread pooling with spring flux and spring flux web client?
body: <p>Consider a simple controller</p>
  
  <pre><code>import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.reactive.function.client.WebClient;
  
  @RestController
  public class DtoController {
  
      private final WebClient client = WebClient.create("http://localhost:8081");
  
      @GetMapping("/booking")
      public Mono&lt;MyDto&gt; getDto() {
          return carsClient.get().uri("/myUrl")
                  .retrieve()
                  .bodyToMono(MyDto.class);
      }
  
  }
  </code></pre>
  
  <p>A documentation tells that in spring web flux there are single IO thread and N workers (N - CPU core count). And worker threads
  are reused between Mono/Flux calls.</p>
  
  <p>But when I run this application I see that in addition to spring flux spring web client also creates IO thread and N workers. So I got:</p>
  
  <pre><code>"Attach Listener"@11 046: RUNNING
  "DestroyJavaVM"@9 089 in group "main": RUNNING
  "Finalizer"@11 048: WAIT
  "ObjectCleanerThread"@6 732 in group "main": WAIT
  "reactor-http-nio-1"@6 711 in group "main": RUNNING
  "reactor-http-nio-2"@6 713 in group "main": RUNNING
  "reactor-http-nio-3"@6 715 in group "main": RUNNING
  "reactor-http-nio-4"@6 714 in group "main": RUNNING
  "Reference Handler"@11 049: WAIT
  "RMI Scheduler(0)"@1 798: WAIT
  "RMI TCP Accept-0"@1 288: RUNNING
  "RMI TCP Accept-0"@1 445: RUNNING
  "RMI TCP Accept-59098"@1 355: RUNNING
  "Signal Dispatcher"@11 047: RUNNING
  "SimplePauseDetectorThread_0"@6 329: SLEEPING
  "Thread-15"@6 328: WAIT
  "XNIO-1 Accept"@8 573 in group "main": RUNNING
  "XNIO-1 I/O-1"@8 518 in group "main": RUNNING
  "XNIO-1 I/O-2"@8 537 in group "main": RUNNING
  "XNIO-1 I/O-3"@8 547 in group "main": RUNNING
  "XNIO-1 I/O-4"@8 552 in group "main": RUNNING
  </code></pre>
  
  <p>Threads with <code>reactor-http-nio</code> prefix correspond to spring application, while <code>XNIO</code> to web flux client.</p>
  
  <p>Is there a way to reuse workers between web client and application? And is it a good idea to reuse those threads?</p>